# Stop a job

`POST /api/v1/jobs/{id}/cancel`

Stops a running job. Results already delivered stay (and stay charged); the credits held for the rest go back at once.

**Credits:** Free.

## Parameters

| Name | Type | Required | What it is |
| --- | --- | --- | --- |
| `id` | integer | yes | The id. |

## Example request

```bash
curl -X POST "https://moleman.io/api/v1/jobs/123/cancel" \
  -H "Authorization: Bearer $MOLEMAN_API_KEY"
```

## Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | [`missing_api_key`](/docs/errors#missing_api_key) | The request has no API key. |
| 401 | [`invalid_api_key`](/docs/errors#invalid_api_key) | The API key is not one of ours (a typo, a cut-off copy, or a key from another account that was deleted). |
| 401 | [`revoked_api_key`](/docs/errors#revoked_api_key) | The API key was revoked on the API page. Revoking takes effect at once. |
| 429 | [`rate_limited`](/docs/errors#rate_limited) | More than 120 requests in one minute with this key. |
| 500 | [`server_error`](/docs/errors#server_error) | Something broke on our side. Nothing was charged for it. |
| 400 | [`invalid_request`](/docs/errors#invalid_request) | A parameter is missing, has the wrong type or is out of range. `details` lists every problem with its path. |
| 400 | [`invalid_json`](/docs/errors#invalid_json) | The body is not valid JSON. |
| 409 | [`idempotency_in_progress`](/docs/errors#idempotency_in_progress) | A request with the same Idempotency-Key is still running. |
| 422 | [`idempotency_key_reused`](/docs/errors#idempotency_key_reused) | The Idempotency-Key was already used in the last 24 hours with a different request. |
| 404 | [`not_found`](/docs/errors#not_found) | The job or list does not exist, belongs to another account, or was deleted. |
| 403 | [`wrong_key_mode`](/docs/errors#wrong_key_mode) | A test key asked for something made with a live key, or the other way round. Test and live data never mix. |
