---
title: "Cancel a running discovery job."
method: POST
path: "/mcp/jobs/{jobId}/cancel"
tags: ["discovery"]
---

# Cancel a running discovery job.

`POST /mcp/jobs/{jobId}/cancel`

## Request

- Base URL: `https://api.prosp.cc`
- URL: `https://api.prosp.cc/mcp/jobs/{jobId}/cancel`
- Auth: OAuth 2 (client credentials, token URL `https://prosp-mcp-641053169627.auth.eu-central-1.amazoncognito.com/oauth2/token`, scopes: `mcp/execute`)

Stops a running discovery, releasing its concurrency slot so a new `execute` can start.
Credits are refunded on the server side (see `credits_refunded`) only when the run had
delivered **zero** prospects at cancel time; if prospects were already delivered you keep
them and are not refunded. Those already-delivered prospects remain retrievable after
cancellation via `GET /mcp/jobs/{jobId}/result` and `GET /api/v1/discoveries/{jobId}`
(`cancelled` is a terminal state that carries its delivered results).
Only the job's owner may cancel it. Cancelling an already-terminal job is a no-op that
returns the job's current state.

## Response `200`

The job's post-cancel state (and any refund applied).

- JobCancelled: Result of `POST /mcp/jobs/{jobId}/cancel` — the job's post-cancel state and any refund applied.
  - `jobId` string, required: Id of the cancelled discovery.
  - `status` 'queued' | 'running' | 'processing' | 'completed' | 'failed' | 'exhausted' | 'cancelled', required: Discovery lifecycle state. `queued` = accepted, not yet started; `running` and `processing` = discovery in progress; `completed` = finished and reached its target; `failed` = ended with an error; `exhausted` = finished but ran out of candidates before hitting the target; `cancelled` = stopped by the caller via `POST /mcp/jobs/{jobId}/cancel`. The last four are terminal.
  - `credits_refunded` integer, nullable: Credits returned to the caller's balance for the cancelled run. Null/0 when nothing was refundable.
  - `credits_refund_reason` string, nullable: Human-readable reason the refund was (or was not) applied.

## Other responses

- `400`: Malformed request (missing/invalid field or header).
- `401`: Missing/invalid/expired Bearer token.
- `403`: The token's tenant does not own this job.
- `405`: HTTP method not allowed on this endpoint (rejected before any credit debit).
- `429`: Rate limit exceeded (100 requests / 60s per customer).

---

[API](https://skmtc.dev/prosp/apis/prosp-discovery-api.md) · [All operations](https://skmtc.dev/prosp/apis/prosp-discovery-api/llms.txt) · [OpenAPI document](https://skmtc.dev/prosp/apis/prosp-discovery-api/revisions/1f2e0c55da22?raw)
