> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# Cancel a job

DELETE https://synth.emtelligent.com/v1/jobs/{job_id}

Cancel a queued job, or one that is running (its results are discarded). Canceled jobs aren't billed.

Reference: https://docs.emtelligent.com/synth/api/jobs/cancel-job-v-1-jobs-job-id-delete

## Authentication

- `Authorization` header (bearer token, required) — An API key, or an OAuth 2.0 access token, with the `synth:process` scope.

## Request

### Path parameters

- `job_id` (string, required)

## Response

### 200

Successful Response

- `id` (string, required)
- `status` (enum, required)
  - Allowed values: `queued`, `running`, `succeeded`, `failed`, `canceled`
- `created_at` (datetime, required)
- `num_documents` (integer, required) — Clinical documents requested.
- `attempts` (integer, required) — Times processing started; a job interrupted on our side is retried.
- `started_at` (datetime, optional, nullable)
- `finished_at` (datetime, optional, nullable)
- `error` (JobError, optional, nullable) — Why the job failed, if it did.
- `summary` (JobSummary, optional, nullable) — The patient generated, once succeeded.
- `results` (list of ResultFile, optional) — Files ready to download.
- `results_expire_at` (datetime, optional, nullable) — Files not downloaded by then are deleted.

## Errors

### 401 Unauthorized Error

Missing or invalid credentials (`invalid_credentials`)

- `error` (ErrorDetail, required)

### 402 Payment Required Error

Organization suspended or out of credit

- `error` (ErrorDetail, required)

### 404 Not Found Error

No such job for your organization (`not_found`)

- `error` (ErrorDetail, required)

### 422 Unprocessable Entity Error

The request is invalid (`request_validation`)

- `error` (ErrorDetail, required)

### 503 Service Unavailable Error

Temporarily unavailable; retry with backoff

- `error` (ErrorDetail, required)

## Types

### JobError

- `code` (string, required) — Why it failed, e.g. `invalid_request` or `generation_failed`.
- `message` (string, required) — What went wrong and what to do, for people.

### JobSummary

- `patient_id` (string, required)
- `complexity` (integer, required) — The complexity used (chosen at random if not requested).
- `seed` (integer, required) — Send it as `seed` with the same request to generate the same patient again.
- `counts` (Counts, required)

### ResultFile

- `name` (enum, required) — Use in the download URL.
  - Allowed values: `fhir`, `notes`, `pdf`, `result`
- `filename` (string, required) — Suggested file name.
- `content_type` (string, required)
- `size_bytes` (integer, required)
- `url` (string, required) — Where to download it (once).

### ErrorDetail

- `code` (string, required) — Stable error code, e.g. `not_found`; branch on this.
- `message` (string, required) — What went wrong, for people. May change.
- `request_id` (string, required, nullable) — Also in the `X-Request-Id` header; quote it to support.

### Counts

- `conditions` (integer, required)
- `medications` (integer, required)
- `allergies` (integer, required)
- `procedures` (integer, required)
- `immunizations` (integer, required)
- `encounters` (integer, required)
- `observations` (integer, required) — Vital signs and laboratory results.
- `notes` (integer, required) — Clinical documents.

## Examples

**Response**

```json
{
  "id": "99eebed0-23d5-4e9d-b07a-ff490b928ad9",
  "status": "canceled",
  "created_at": "2026-10-15T07:38:53.039658Z",
  "num_documents": 5,
  "attempts": 0,
  "started_at": null,
  "finished_at": "2026-10-15T07:38:53.057287Z",
  "error": null,
  "summary": null,
  "results": [],
  "results_expire_at": null
}
```

**SDK Code**

```python A canceled job
import requests

url = "https://synth.emtelligent.com/v1/jobs/job_id"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript A canceled job
const url = 'https://synth.emtelligent.com/v1/jobs/job_id';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go A canceled job
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://synth.emtelligent.com/v1/jobs/job_id"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby A canceled job
require 'uri'
require 'net/http'

url = URI("https://synth.emtelligent.com/v1/jobs/job_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java A canceled job
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://synth.emtelligent.com/v1/jobs/job_id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php A canceled job
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://synth.emtelligent.com/v1/jobs/job_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp A canceled job
using RestSharp;

var client = new RestClient("https://synth.emtelligent.com/v1/jobs/job_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift A canceled job
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://synth.emtelligent.com/v1/jobs/job_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```