Cancel a sync job

post/v1/datasets/{datasetId}/sources/{sourceId}/sync/jobs/{jobId}/cancel

Removes a job from the queue before a worker picks it up. The request has no body.

Only pending jobs can be cancelled. A cancelled job is recorded as failed with result.error set to Job cancelled by user and result.completedAt set to the cancellation time; it is purged 7 days later like any other finished job. No sync log is created.

Jobs that are already processing cannot be interrupted — wait for them to finish. Calling cancel on a processing, completed or failed job returns 409.

Private keyapi.v1.datasets.sources.syncJobs.cancelNo demo

Path parameters

3
datasetIdstring (uuid)required

The dataset the source belongs to.

sourceIdstring (uuid)required

The source the job belongs to.

jobIdstring (uuid)required

The pending job to cancel.

Response

200The job was cancelled.
successbooleanrequired

Always true on a 2xx response.

messagestringrequired

Always Sync job cancelled successfully.

Errors

19

Every error is JSON with a single error string unless noted. Match on the status code; the message is for humans.

404
Sync job not found

No job with that jobId belongs to the organization that owns the key under the datasetId and sourceId in the path, or it has already been purged.

409
Cannot cancel job with status '<status>'. Only pending jobs can be cancelled.

The job is processing, completed or failed. The message names the job's current status.

curl -X POST "https://stylor.ai/api/v1/datasets/YOUR_DATASET_ID/sources/YOUR_SOURCE_ID/sync/jobs/YOUR_JOB_ID/cancel" \
  -H "Authorization: Bearer $STYLOR_API_KEY"
Response · 200
{
  "success": true,
  "message": "Sync job cancelled successfully"
}