---
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 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

---

[API](https://skmtc.net/airweave-ai/apis/airweave.md) · [All operations](https://skmtc.net/airweave-ai/apis/airweave/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/airweave-ai/airweave/revisions/bf410c28c0c6/schema)
