Start AI prioritization for the selected defect groups

Each accepted request starts a new operation, even for the same groups. Overlapping requests can process the same groups concurrently. Poll GET /v1/operations/{operationUuid} with the same gitRepo.

Request

POST

https://appsec.sourcecraft.tech/v1/ai/prioritize

Query parameters

Name

Description

gitRepo

Type: string

Repository identifier. Accepts either internal repository ID (e.g., 88769874964302633) or public UUID (e.g., 0199140f-4343-7c06-a7e3-b835c305b629). These values can be obtained from the getRepo API (fields: id and uuid).

Pattern: \S

Example: ``

Body

application/json
{
  "defectGroupPublicIds": [
    0
  ]
}

Name

Description

defectGroupPublicIds

Type: integer[]

Public defect group numbers in the selected repository

Min items: 1

Example
[
  0
]

Responses

202 Accepted

Operation accepted

Body

application/json
{
  "operationUuid": "example",
  "type": "ACTIVITY_AI_SUGGESTION",
  "status": "IN_PROGRESS",
  "done": true,
  "gitRepo": "example",
  "createdAt": 0,
  "updatedAt": 0,
  "createdBy": "example",
  "entityUuid": "example",
  "createdEntityUuid": "example",
  "metadata": {
    "gitRepo": "example",
    "defectGroupUuid": "example",
    "jobId": "example",
    "linkUuid": "example",
    "activityUuid": "example"
  }
}

Name

Description

createdAt

Type: integer

Creation time in milliseconds since the Unix epoch

createdBy

Type: string

Example: example

createdEntityUuid

Type: string | null

UUID of the generated report, suggestion activity or AI agent run, depending on type. May be allocated before completion; check status before using the result.

Example: example

done

Type: boolean

True for both COMPLETED and FAILED; inspect status to distinguish success from failure

entityUuid

Type: string | null

UUID of the source entity: a scan for report generation or a defect group for AI suggestion/fix

Example: example

gitRepo

Type: string

Repository identifier stored with the operation; may be an ID, public UUID or a legacy identifier

Example: example

metadata

Type: object | null

Any of 2 types
  • Type: OperationAgentMetadataDto

    Example
    {
      "gitRepo": "example",
      "defectGroupUuid": "example",
      "jobId": "example",
      "linkUuid": "example",
      "activityUuid": "example"
    }
    
  • Type: null

    Example: null

Metadata of an AI fix, triage or audit job, when available

Example
{
  "gitRepo": "example",
  "defectGroupUuid": "example",
  "jobId": "example",
  "linkUuid": "example",
  "activityUuid": "example"
}

operationUuid

Type: string

Example: example

status

Type: OperationStatus

Enum: IN_PROGRESS, COMPLETED, FAILED

type

Type: OperationType

Enum: ACTIVITY_AI_SUGGESTION, DEFECT_GROUPS_BATCH_PRIORITIZE, GENERATE_REPORT, TRIGGER_DEFECT_FIX, TRIGGER_AUDIT, GENERATE_SARIF_REPORT_ALL, GENERATE_SARIF_REPORT_SECRETS, GENERATE_SARIF_REPORT_SCA, GENERATE_SARIF_REPORT_SAST, GENERATE_SARIF_REPORT_DAST, AGENT_TRIAGE, STOP_SCAN, CREATE_SCA_RESCAN

updatedAt

Type: integer

Last update time in milliseconds since the Unix epoch

OperationType

Type: string

Enum: ACTIVITY_AI_SUGGESTION, DEFECT_GROUPS_BATCH_PRIORITIZE, GENERATE_REPORT, TRIGGER_DEFECT_FIX, TRIGGER_AUDIT, GENERATE_SARIF_REPORT_ALL, GENERATE_SARIF_REPORT_SECRETS, GENERATE_SARIF_REPORT_SCA, GENERATE_SARIF_REPORT_SAST, GENERATE_SARIF_REPORT_DAST, AGENT_TRIAGE, STOP_SCAN, CREATE_SCA_RESCAN

OperationStatus

Type: string

Enum: IN_PROGRESS, COMPLETED, FAILED

OperationAgentMetadataDto

Name

Description

defectGroupUuid

Type: string | null

Example: example

gitRepo

Type: string

Example: example

jobId

Type: string | null

AI job ID; null while the agent job is still being started

Example: example

linkUuid

Type: string | null

UUID of the defect group's SOURCECRAFT_PR link, once reported by the fix agent

Example: example

activityUuid

Type: string | null

UUID of the accepted triage result activity; null until a result is saved

Example: example

Example
{
  "gitRepo": "example",
  "defectGroupUuid": "example",
  "jobId": "example",
  "linkUuid": "example",
  "activityUuid": "example"
}

400 Bad Request

Missing or invalid repository identifier or request

401 Unauthorized

Missing or invalid authorization header

403 Forbidden

AppSec write permission denied

404 Not Found

Repository, organization or requested defect group not found

409 Conflict

Required neurocolleague or latest-scan findings missing