POST
/
job-cancel
/
{job_id}
Cancelling a Job
curl --request POST \
  --url https://api.sutro.sh/job-cancel/{job_id} \
  --header 'Authorization: <authorization>'
{
  "cancelled": true,
  "message": "Job batch_job_12345 has been successfully cancelled"
}
Cancel a batch inference job by its job_id.

Request Parameters

job_id
string
required
The job_id returned when you submitted the batch inference job

Headers

Authorization
string
required
Your Sutro API key using Key authentication scheme.Format: Key YOUR_API_KEYExample: Authorization: Key sk_live_abc123...

Response

Returns the cancellation status of the job.
cancelled
boolean
True if the job was cancelled, False otherwise
message
string
Verbose message describing the job’s cancellation status
{
  "cancelled": true,
  "message": "Job batch_job_12345 has been successfully cancelled"
}

Code Examples

import requests

job_id = "batch_job_12345"

response = requests.post(
    f'https://api.sutro.sh/job-cancel/{job_id}',
    headers={
        'Authorization': 'Key YOUR_SUTRO_API_KEY',
        'Content-Type': 'application/json'
    }
)

result = response.json()
if result['cancelled']:
    print(f"Job {job_id} was successfully cancelled")
else:
    print(f"Failed to cancel job: {result['message']}")

Notes

  • Jobs can only be cancelled if they are in a cancellable state (e.g., pending, submitted, starting, or running)
  • Jobs that have already completed, failed, or been previously cancelled cannot be cancelled
  • The cancellation is asynchronous - the job may take a moment to fully stop after receiving the cancellation request