Cancel one or more in-flight enrichment jobs, including jobs still pending (queued) that haven't started processing yet. Any records already enriched remain preserved and stay retrievable via GET /get-job-results. Only jobs still pending or processing are cancellable — jobs already completed, failed, or cancelled are returned in already_terminal untouched.
#Request
# Cancel one job
curl -X POST "https://uunrlffonnvmbsstkpze.supabase.co/functions/v1/cancel-enrich-job" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"job_id": "uuid-here"}'
# Cancel many at once (up to 500 per call)
curl -X POST "https://uunrlffonnvmbsstkpze.supabase.co/functions/v1/cancel-enrich-job" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"job_ids": ["uuid-a", "uuid-b", "uuid-c"]}'#Request Fields
| Field | Type | Required | Description |
|---|---|---|---|
| job_id | string | Either this or job_ids |
Single job_id returned by /enrich. |
| job_ids | string[] | Either this or job_id |
Up to 500 job_ids to cancel in one call. |
#Response (200 OK)
{
"success": true,
"cancelled": ["uuid-a", "uuid-b"],
"already_terminal": [{ "job_id": "uuid-c", "status": "completed" }],
"not_found": [],
"failed": [],
"message": "Cancelled 2 enrichment jobs. Records already enriched are preserved and remain retrievable via GET /get-job-results."
}Notes:
- Queued jobs (
pending, no records leased yet) cancel instantly with zero records processed. - In-flight records already leased by workers finish out and are counted in the final stats; the job stops accepting new work immediately.
- Cancellation is safe to call twice on the same
job_id— the second call returns it inalready_terminalwithstatus: "cancelled". - API keys can only cancel jobs owned by their user; unknown or foreign IDs come back in
not_found.