Cancel a running or queued scan
POST
/projects/{projectId}/scans/{scanId}/cancel
const url = 'https://zkao.io/api/v1/projects/example/scans/example/cancel';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://zkao.io/api/v1/projects/example/scans/example/cancel \ --header 'Authorization: Bearer <token>'Requires scope: scans:launch. Signals any in-flight jobs to stop, marks the scan CANCELLED, and releases its reserved credits (in-flight jobs settle their actual spend as they wind down). A scan that already reached COMPLETED or FAILED cannot be cancelled (400).
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”projectId
required
string
scanId
required
string
Responses
Section titled “ Responses ”OK
Media typeapplication/json
object
scanId
required
string
status
required
Terminal status after cancellation (always CANCELLED).
string
cancelledJobs
required
Number of in-flight jobs signalled to stop.
integer
Example
{ "status": "QUEUED"}Invalid request
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example
{ "error": { "code": "unauthorized" }}Missing, malformed, expired, or revoked token
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example
{ "error": { "code": "unauthorized" }}The token lacks the required scope
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example
{ "error": { "code": "unauthorized" }}Resource not in this token’s project or repo allowlist
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example
{ "error": { "code": "unauthorized" }}Rate limited. Either the token’s spend limit for the current period is reached (on launch), or the token is sending too many requests. Wait the number of seconds in the Retry-After header before retrying.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example
{ "error": { "code": "unauthorized" }}Headers
Section titled “Headers”Retry-After
integer
Seconds to wait before retrying.

