Request cancellation of a scan's CI run
The backend resolves the stored CI run in the authorized repository and cancels it with the caller's token. Poll GET /v1/operations/{operationUuid} until done. Only scans linked to a CI run can be stopped. No request body is required.
Request
POST
https://appsec.sourcecraft.tech/v1/scans/{scanUuid}/stop
Path parameters
|
Name |
Description |
|
scanUuid |
Type: string UUID of the scan to stop Example: `` |
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: Example: `` |
Responses
202 Accepted
Scan stop operation
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: |
|
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: |
|
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: |
|
gitRepo |
Type: string Repository identifier stored with the operation; may be an ID, public UUID or a legacy identifier Example: |
|
metadata |
Type: object | null Any of 2 types
Metadata of an AI fix, triage or audit job, when available Example
|
|
operationUuid |
Type: string Example: |
|
status |
Type: OperationStatus Enum: |
|
type |
Type: OperationType Enum: |
|
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
OperationStatus
Type: string
Enum: IN_PROGRESS, COMPLETED, FAILED
OperationAgentMetadataDto
|
Name |
Description |
|
defectGroupUuid |
Type: string | null Example: |
|
gitRepo |
Type: string Example: |
|
jobId |
Type: string | null AI job ID; null while the agent job is still being started Example: |
|
linkUuid |
Type: string | null UUID of the defect group's SOURCECRAFT_PR link, once reported by the fix agent Example: |
|
activityUuid |
Type: string | null UUID of the accepted triage result activity; null until a result is saved Example: |
Example
{
"gitRepo": "example",
"defectGroupUuid": "example",
"jobId": "example",
"linkUuid": "example",
"activityUuid": "example"
}
400 Bad Request
Missing gitRepo or invalid scan UUID
401 Unauthorized
Missing or invalid authorization header
403 Forbidden
AppSec write permission denied
404 Not Found
Repository or scan not found in this repository
409 Conflict
The scan has no linked CI run
503 Service Unavailable
CI could not accept cancellation