---
title: "Create Autofix"
method: POST
path: "/api/v1/deployments/{deploymentId}/issues/{issueId}/autofix"
tags: ["AutofixService"]
---

# Create Autofix

`POST /api/v1/deployments/{deploymentId}/issues/{issueId}/autofix`

This feature is currently in Public Beta.

Triggers an Autofix workflow for the given issue. The workflow runs asynchronously; it analyzes the issue, generates a fix, and opens a pull request in the underlying repository. Supports SAST, AI SAST, and SCA issue types — the issue's type is resolved server-side and dispatched to the corresponding Autofix path.

A `success: true` response means the Autofix job has been **accepted for processing**, not that a pull request has been opened. The PR is created by an asynchronous workflow that runs after this endpoint returns.

## Path parameters

- `deploymentId` integer, required — The unique numerical identifier of the deployment. Can be found via the [Deployments Service](#tag/DeploymentsService) or in your Settings in the web UI.
- `issueId` integer, required — The unique numerical identifier of the issue to generate a fix for.

## Request body

- ProtosAiV1CreateAutofixRequest — Request message for creating a unified Autofix job.

## Response `200`

OK

- ProtosAiV1CreateAutofixResponse — Response message for creating a unified Autofix job.
  - `errors` ProtosAiV1AutofixError[] — A list of errors that occurred during Autofix job creation. Empty when the job was accepted for processing.
    - `errorType` 'AUTOFIX_ERROR_TYPE_ISSUE_NOT_FOUND' | 'AUTOFIX_ERROR_TYPE_UNSUPPORTED_ISSUE_TYPE' | 'AUTOFIX_ERROR_TYPE_AUTOFIX_NOT_ENABLED' | 'AUTOFIX_ERROR_TYPE_INVALID_REPOSITORY' | 'AUTOFIX_ERROR_TYPE_NO_WRITE_ACCESS' | 'AUTOFIX_ERROR_TYPE_SCM_CONFIG_NOT_FOUND' | 'AUTOFIX_ERROR_TYPE_SCM_TOKEN_FAILED' | 'AUTOFIX_ERROR_TYPE_CODE_ACCESS_NOT_GRANTED' | 'AUTOFIX_ERROR_TYPE_CREDITS_EXHAUSTED' | 'AUTOFIX_ERROR_TYPE_IN_FLIGHT_FIX_PENDING' | 'AUTOFIX_ERROR_TYPE_NO_RECOMMENDED_UPGRADE' | 'AUTOFIX_ERROR_TYPE_INVALID_ISSUE_STATE', enum — The type of error that occurred during Autofix job creation. | value | description | |-------|---------------| | AUTOFIX_ERROR_TYPE_ISSUE_NOT_FOUND | The issue ID does not exist for this deployment. | | AUTOFIX_ERROR_TYPE_UNSUPPORTED_ISSUE_TYPE | Autofix is not supported for this issue type. Currently SAST, AI SAST, and SCA are supported. | | AUTOFIX_ERROR_TYPE_AUTOFIX_NOT_ENABLED | Autofix is not enabled for this organization, repository, or issue. | | AUTOFIX_ERROR_TYPE_INVALID_REPOSITORY | The repository associated with the issue is invalid, archived, or not found. | | AUTOFIX_ERROR_TYPE_NO_WRITE_ACCESS | The Semgrep app does not have write access to the repository. | | AUTOFIX_ERROR_TYPE_SCM_CONFIG_NOT_FOUND | No source code management configuration was found for the repository. | | AUTOFIX_ERROR_TYPE_SCM_TOKEN_FAILED | Failed to obtain an SCM access token for the repository. | | AUTOFIX_ERROR_TYPE_CODE_ACCESS_NOT_GRANTED | Code access has not been granted for the repository. | | AUTOFIX_ERROR_TYPE_CREDITS_EXHAUSTED | The organization has exhausted its AI credits. | | AUTOFIX_ERROR_TYPE_IN_FLIGHT_FIX_PENDING | An Autofix job is already in progress for this issue. Please wait for it to complete before retrying. | | AUTOFIX_ERROR_TYPE_NO_RECOMMENDED_UPGRADE | No recommended upgrade version is available for this dependency (SCA only). | | AUTOFIX_ERROR_TYPE_INVALID_ISSUE_STATE | The issue is in a state that does not support Autofix (for example, already fixed or ignored). |
    - `message` string — A human-readable description of the error.
  - `success` boolean — Indicates whether the Autofix job was accepted for processing. Note: this does NOT mean a pull request has been opened — the PR is created by an asynchronous workflow that runs after this endpoint returns.

---

[API](https://skmtc.net/semgrep/apis/semgrep-web-app.md) · [All operations](https://skmtc.net/semgrep/apis/semgrep-web-app/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/semgrep/semgrep-web-app/revisions/6483eeecd582/schema)
