---
title: "Cancel Sync Job"
method: POST
path: "/source-connections/{source_connection_id}/jobs/{job_id}/cancel"
tags: ["source-connections"]
---

# Cancel Sync Job

`POST /source-connections/{source_connection_id}/jobs/{job_id}/cancel`

## Request

- Base URL: `https://api.airweave.ai`
- URL: `https://api.airweave.ai/source-connections/{source_connection_id}/jobs/{job_id}/cancel`
- Auth: API key in header `x-api-key`

Request cancellation of a running sync job.

**State lifecycle**: `PENDING` / `RUNNING` → `CANCELLING` → `CANCELLED`

1. The API immediately marks the job as **CANCELLING** in the database.
2. A cancellation signal is sent to the Temporal workflow.
3. The worker receives the signal, gracefully stops the sync pipeline
   (cancels worker pool, source stream), and marks the job as **CANCELLED**.

Already-processed entities are retained in the vector database.
If the worker is unresponsive, a background cleanup job will force the
transition to CANCELLED after 3 minutes.

**Note**: Only jobs in `PENDING` or `RUNNING` state can be cancelled.
Attempting to cancel a `COMPLETED`, `FAILED`, or `CANCELLED` job returns 400.

## Path parameters

- `source_connection_id` string, uuid, required: Unique identifier of the source connection (UUID)
- `job_id` string, uuid, required: Unique identifier of the sync job to cancel (UUID)

## Response `200`

Job with cancellation status

- SourceConnectionJob: A sync job representing a single synchronization run. Sync jobs track the execution of data synchronization from a source connection. Each job includes timing information, entity counts, and error details if applicable.
  - `id` string, uuid, required: Unique identifier of the sync job
  - `source_connection_id` string, uuid, required: ID of the source connection this job belongs to
  - `status` 'created' | 'pending' | 'running' | 'completed' | 'failed' | 'cancelling' | 'cancelled', required: Sync job status enum.
  - `started_at` string, date-time, nullable: When the job started execution (ISO 8601)
  - `completed_at` string, date-time, nullable: When the job finished (ISO 8601). Null if still running.
  - `duration_seconds` number, nullable: Total execution time in seconds. Null if still running.
  - `entities_inserted` integer: Number of new entities created during this sync
  - `entities_updated` integer: Number of existing entities updated during this sync
  - `entities_deleted` integer: Number of entities removed during this sync
  - `entities_failed` integer: Number of entities that failed to process
  - `error` string, nullable: Error message if the job failed
  - `error_details` object, nullable: Additional error context for debugging

## Other responses

- `404`: Job Not Found
- `409`: Job Cannot Be Cancelled
- `422`: Validation Error
- `429`: Rate Limit Exceeded

## Changes

> 63 revisions in range; 2 not diffed.

- **2026-02-04** `9c8b36d8fcaa`: 3 info
  - added the non-success response with the status `404`
  - added the non-success response with the status `409`
  - added the non-success response with the status `429`
- **2025-10-03** `d2bbfbd6e62f`: 1 warning
  - removed the optional property `entities_processed` from the response with the `200` status
- **2025-09-26** `97475c7322d4`: 1 warning
  - added the new `cancelling` enum value to the `status` response property for the response status `200`
- **2025-09-19** `097d993fdf58`: 1 breaking, 10 warning, 10 info
  - removed the required property `organization_id` from the response with the `200` status
  - removed the optional property `created_at` from the response with the `200` status
  - removed the optional property `created_by_email` from the response with the `200` status
  - removed the optional property `entities_encountered` from the response with the `200` status
  - …17 more
- **2025-09-01** `f0b57c4a56ce`: 1 info
  - api operation id `cancel_source_connection_job_source_connections__source_connection_id__jobs__job_id__cancel_post` removed and replaced with `cancel_job_source_connections__source_connection_id__jobs__job_id__cancel_post`

[Operation history](https://skmtc.dev/airweave-ai/apis/airweave/changes/source-connections/:source_connection_id/jobs/:job_id/cancel/post.md)

---

[API](https://skmtc.dev/airweave-ai/apis/airweave.md) - [All operations](https://skmtc.dev/airweave-ai/apis/airweave/llms.txt) - [OpenAPI document](https://skmtc.dev/airweave-ai/apis/airweave/revisions/bf410c28c0c6?raw)
