> ## Documentation Index
> Fetch the complete documentation index at: https://docs.landing.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Asynchronous Extraction (Extract Jobs)

> Extract from large Markdown documents asynchronously with Extract Jobs v2, then poll for results.

export const dpt3 = 'DPT-3';

export const extractDpt3 = 'Extract';

Use Extract Jobs v2 to extract structured data asynchronously. Instead of waiting for a single request to finish, you create a job, receive a `job_id` immediately, and retrieve the result when the job completes.

Use Extract Jobs for long-running extractions, such as extracting from long documents or with large, complex schemas.

## Endpoints

The request fields are the same as the synchronous Extract API. See [Extract Input Parameters](./extract-input).

Extract Jobs uses these endpoints:

| Method | Endpoint                    | Purpose                             |
| ------ | --------------------------- | ----------------------------------- |
| POST   | `/v2/extract/jobs`          | Create an extract job.              |
| GET    | `/v2/extract/jobs/{job_id}` | Get the status and result of a job. |

## Workflow

1. Build your extraction schema. See [Extraction Schema (JSON)](./ade-extract-schema-json).
2. Submit the Markdown and schema to `POST /v2/extract/jobs`.
3. Get the `job_id` from the response.
4. Poll `GET /v2/extract/jobs/{job_id}` until `status` is `completed`.
5. Read the extracted fields from the job's `result`. See [Extract API Response](./extract-response).

## Create a Job

Send the same fields you would send to the synchronous endpoint. Replace `YOUR_API_KEY` with your [API key](./agentic-api-key) and `parse-output.md` with the path to your Markdown file.

```bash theme={null}
curl -X POST 'https://api.ade.landing.ai/v2/extract/jobs' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'markdown=@parse-output.md' \
  -F 'schema={"type":"object","properties":{"revenue":{"type":"string","description":"Q1 2024 revenue"}}}'
```

The request returns a `202` response with the `job_id` and the initial status:

```json theme={null}
{
  "job_id": "d3kpfw9bf0ez7e501an5qqe8z",
  "status": "pending",
  "created_at": 1781819747
}
```

### Choose a Service Tier

Set the optional `service_tier` form field to control the job's turnaround time and credit consumption. If you omit `service_tier`, the job runs on the `standard` tier. For credit consumption by tier, see [Credit Consumption](./credit-consumption#extract-jobs).

| Tier       | Behavior                                                                                                                       |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `standard` | Consumes half the credits of the `priority` tier, with a slower turnaround. Best for cost-sensitive or non-urgent workloads.   |
| `priority` | Consumes credits at the full rate, the same as synchronous extraction, with a faster turnaround. Best for time-sensitive jobs. |

**Set the tier.**

Include the `service_tier` field in your create-job request:

```bash highlight={5} theme={null}
curl -X POST 'https://api.ade.landing.ai/v2/extract/jobs' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'markdown=@parse-output.md' \
  -F 'schema={"type":"object","properties":{"revenue":{"type":"string","description":"Q1 2024 revenue"}}}' \
  -F 'service_tier=priority'
```

## Get a Job

Poll the job with its `job_id`:

```bash theme={null}
curl 'https://api.ade.landing.ai/v2/extract/jobs/JOB_ID' \
  -H 'Authorization: Bearer YOUR_API_KEY'
```

The response includes the job status and, once the job finishes, the result:

| Field          | Description                                                                                                                                                            |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `job_id`       | The unique identifier for the job.                                                                                                                                     |
| `status`       | The current state of the job. See [Job Statuses](#job-statuses).                                                                                                       |
| `created_at`   | When the job was created.                                                                                                                                              |
| `completed_at` | When the job finished. Present once the job reaches a final state.                                                                                                     |
| `progress`     | How far the job has progressed, from `0` to `1`. Present while the job is processing.                                                                                  |
| `result`       | The extraction result, present when `status` is `completed`. This object has the same shape as a synchronous response. See [Extract API Response](./extract-response). |
| `error`        | Present when `status` is `failed`. Contains a `code` and a `message`.                                                                                                  |

## Job Statuses

| Status       | Description                                                    |
| ------------ | -------------------------------------------------------------- |
| `pending`    | The job is accepted and queued, but has not started.           |
| `processing` | The job is running.                                            |
| `completed`  | The job finished. Read the extraction from the `result` field. |
| `failed`     | The job did not finish. See the `error` field for details.     |

## Rate Limits

Extract Jobs submissions are always accepted (HTTP 202) and never return a rate-limit error; jobs are paced internally instead. There is no input size cap. See [Rate Limits](./rate-limits#extract-jobs).
