---
title: "Extract from many files in one call"
---

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

# Extract from many files in one call

Path: CloudRaker Paperwork API › Capabilities

`POST /v1/extract/batch`

Runs one saved extraction action over up to 100 files, creating one ordinary run per file.

A batch is fan-out sugar, not a new object: there is no batch id and nothing to poll for the batch as a whole. You get back a run id per file — read each one with [GET /v1/runs/{id}](https://docs.cloudraker.com/paperwork/api/runs/get-run), or list them together with [GET /v1/runs](https://docs.cloudraker.com/paperwork/api/runs/list-runs) using the `metadata` you attached.

**A saved `action` is required.** Inline `schema` and `hints` are accepted on [POST /v1/extract](https://docs.cloudraker.com/paperwork/api/capabilities/extract) only — running the same shape over a hundred files is exactly when that shape should be a reviewed, saved asset.

`metadata`, `webhook`, `ttl` and `citations` are copied onto every run, so one webhook endpoint receives all of them and one flag grounds the whole batch.

```json
{
  "action": "invoice-fields",
  "files": [{ "id": "a04d6597-…" }, { "url": "https://example.com/invoice-2.pdf" }],
  "metadata": { "batch": "2026-07-25-invoices" }
}
```

**Always asynchronous.** The response is `202` right away. `runs[]` has one entry per file, in the order you sent them: `{id, statusUrl, file}` when the run was created, or `{file, error}` when that one file could not start — the other runs still stand, and `count` reports how many were created.

> **Note:** The whole batch costs a single request against your rate limit, however many files it fans out to.

**Learn more:** [Extraction guide](https://docs.cloudraker.com/paperwork/capabilities/extract)

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

_Required._

- `action` (`extractBatch.action`; string, required) — The saved action every run in the batch uses, by id or slug. Required. Inline `schema` and `hints` are deliberately not accepted here: a batch runs one reviewed, versionable shape over many files.
  - minLength 1; example `"act_01JQ8ZKMRT4V6WXYZ0ABCDEFGH"`
- `files` (`extractBatch.files`; array<any of>, required) — The input files, up to 100. Each one becomes its own run.
  - any of:
    - `object`
      - `url` (`extractBatch.files.1.url`; string, required)
        - format `uri`
      - `name` (`extractBatch.files.1.name`; string, optional)
        - minLength 1
      - `processing` (`extractBatch.files.1.processing`; string, optional)
        - one of `"auto"`, `"ocr"`, `"simple"`, `"transcribe"`, `"transcribe_diarize"`
    - `object`
      - `id` (`extractBatch.files.2.id`; string, required)
        - minLength 1
      - `ephemeral` (`extractBatch.files.2.ephemeral`; boolean, optional) — Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.
- `citations` (`extractBatch.citations`; boolean, optional) — Whether to ground each extracted value in the source document. Off by default — grounding is an explicit add-on, so send `citations: true` to ask for it. When on, `output.citations` maps every extracted field to where it came from — `fileId` plus page and bounding box for documents, or `timecodeStart`/`timecodeEnd` for audio. A field the documents simply do not contain comes back as an entry with `notFound: true` and no location.
- `metadata` (`extractBatch.metadata`; map<unknown>, optional) — Arbitrary JSON you attach to the run and get back on every read of it. Use it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized.
- `webhook` (`extractBatch.webhook`; any of, optional) — Where to deliver this run's events, given one of two ways. - `{ "url": "…" }` — a one-off https endpoint for this run only. - `{ "id": "whe_…" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too. Deliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`.
  - any of:
    - `object`
      - `url` (`extractBatch.webhook.1.url`; string, required)
        - format `uri`
    - `object`
      - `id` (`extractBatch.webhook.2.id`; string, required)
        - minLength 1
- `ttl` (`extractBatch.ttl`; integer, optional) — How long, in seconds, to keep this run and its files before purging them automatically. The maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently. E-signature runs are exempt — an envelope waits for its signers however long that takes.
  - min 1; max 604800; default `86400`

## Example request

```json
{
  "action": "act_01JQ8ZKMRT4V6WXYZ0ABCDEFGH",
  "files": [
    {
      "url": "http://example.com",
      "name": "string",
      "processing": "auto"
    }
  ],
  "citations": true,
  "metadata": {
    "property1": null,
    "property2": null
  },
  "webhook": {
    "url": "http://example.com"
  },
  "ttl": 86400
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.cloudraker.com/v1/extract/batch \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "action": "act_01JQ8ZKMRT4V6WXYZ0ABCDEFGH",
  "files": [
    {
      "url": "http://example.com",
      "name": "string",
      "processing": "auto"
    }
  ],
  "citations": true,
  "metadata": {
    "property1": null,
    "property2": null
  },
  "webhook": {
    "url": "http://example.com"
  },
  "ttl": 86400
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/v1/extract/batch';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    action: 'act_01JQ8ZKMRT4V6WXYZ0ABCDEFGH',
    files: [{url: 'http://example.com', name: 'string', processing: 'auto'}],
    citations: true,
    metadata: {property1: null, property2: null},
    webhook: {url: 'http://example.com'},
    ttl: 86400
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/v1/extract/batch"

payload = {
    "action": "act_01JQ8ZKMRT4V6WXYZ0ABCDEFGH",
    "files": [
        {
            "url": "http://example.com",
            "name": "string",
            "processing": "auto"
        }
    ],
    "citations": True,
    "metadata": {
        "property1": None,
        "property2": None
    },
    "webhook": { "url": "http://example.com" },
    "ttl": 86400
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 202

Accepted — one run per file.

#### Example

```json
{
  "object": "extract_batch",
  "count": 0,
  "runs": [
    {
      "id": "string",
      "statusUrl": "string",
      "file": {
        "url": "http://example.com",
        "name": "string",
        "processing": "auto"
      },
      "error": {
        "code": "string",
        "message": "string"
      }
    }
  ]
}
```

- `object` (`extractBatch.response.202.object`; string, required)
- `count` (`extractBatch.response.202.count`; number, required)
- `runs` (`extractBatch.response.202.runs`; array<object>, required)
  - `file` (`extractBatch.response.202.runs.file`; any of, required) — An input file, given one of two ways. - `{ "url": "…", "name"?: "…", "processing"?: "…" }` — fetched over http(s) for this run and purged with it. - `{ "id": "…" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed. - `{ "id": "…", "ephemeral": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses.
    - any of:
      - `object`
        - `url` (`extractBatch.response.202.runs.file.1.url`; string, required)
          - format `uri`
        - `name` (`extractBatch.response.202.runs.file.1.name`; string, optional)
          - minLength 1
        - `processing` (`extractBatch.response.202.runs.file.1.processing`; string, optional)
          - one of `"auto"`, `"ocr"`, `"simple"`, `"transcribe"`, `"transcribe_diarize"`
      - `object`
        - `id` (`extractBatch.response.202.runs.file.2.id`; string, required)
          - minLength 1
        - `ephemeral` (`extractBatch.response.202.runs.file.2.ephemeral`; boolean, optional) — Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.
  - `id` (`extractBatch.response.202.runs.id`; string, optional)
  - `statusUrl` (`extractBatch.response.202.runs.statusUrl`; string, optional)
  - `error` (`extractBatch.response.202.runs.error`; object, optional)
    - `code` (`extractBatch.response.202.runs.error.code`; string, required)
    - `message` (`extractBatch.response.202.runs.error.message`; string, required)

### 400

Invalid request (`invalid_request`).

### 422

Unusable webhook endpoint.

### 429

Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.

#### Example

```json
{
  "code": "rate_limited",
  "message": "string",
  "retryable": true,
  "requestId": "string",
  "docUrl": "string"
}
```

- `code` (`extractBatch.response.429.code`; string, required)
  - one of `"rate_limited"`
- `message` (`extractBatch.response.429.message`; string, required)
- `retryable` (`extractBatch.response.429.retryable`; boolean, required)
  - one of `true`
- `requestId` (`extractBatch.response.429.requestId`; string, required)
- `docUrl` (`extractBatch.response.429.docUrl`; string, optional)


Source: https://docs.cloudraker.com/paperwork/api/capabilities/extract-batch/index.md
