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

# Parse a Batch

> Parse up to 50 documents in one request: uploads, links and fileIds together, one job each.

Send up to 50 documents in one request, mixing:

* `files`: one or more multipart file parts;
* `urls`: an array of links, or a JSON array string in a multipart request;
* `fileIds`: an array of fileIds.

The options are the same as [POST /parse](/api-reference/parse/parse) and apply to every document. Each document becomes its own job. One that can't be fetched or read is reported on its own and doesn't stop the others.

```bash theme={null}
curl -X POST https://api.spidra.io/api/parse/batch \
  -H "Authorization: Bearer $SPIDRA_API_KEY" \
  -F "files=@report.docx" -F "files=@scan.pdf" \
  -F 'urls=["https://arxiv.org/pdf/1706.03762"]' \
  -F 'options={"maxPages":2}'
```

```json theme={null}
{
  "batchId": "2b4b2076-ab42-4bdf-be7a-343614edd090",
  "documents": [
    { "jobId": "...", "status": "queued", "fileName": "report.docx", "credits": 1 },
    { "jobId": "...", "status": "queued", "fileName": "scan.pdf", "credits": 1 },
    { "jobId": "...", "status": "queued", "fileName": "1706.03762", "credits": 2 }
  ]
}
```

## Check a batch

`GET /api/parse/batch/{batchId}` returns `status` (`running` or `completed`), `counts` per status, `creditsUsed` and each document's status and progress. Add `?include=results` to get each finished document's Markdown.


## OpenAPI

````yaml POST /parse/batch
openapi: 3.1.0
info:
  title: Spidra API
  version: 1.0.0
  description: >-
    Public API endpoints for web scraping via Spidra. Authenticate with
    `Authorization: Bearer YOUR_API_KEY`.
servers:
  - url: https://api.spidra.io/api
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /parse/batch:
    post:
      tags:
        - Parse
      summary: Parse a Batch
      description: >-
        Up to 50 documents (files, urls and fileIds) with the same options, one
        job each.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                urls:
                  type: string
                  description: JSON array of links.
                fileIds:
                  type: string
                  description: JSON array of fileIds.
                options:
                  type: string
                  description: Options as a JSON string.
          application/json:
            schema:
              type: object
              properties:
                urls:
                  type: array
                  items:
                    type: string
                fileIds:
                  type: array
                  items:
                    type: string
                mode:
                  type: string
                  enum:
                    - auto
                    - fast
                    - ocr
                  default: auto
                  description: >-
                    auto: AI only for scanned pages; fast: never AI; ocr: AI on
                    every page.
                pages:
                  type: string
                  description: PDF pages to parse, like "1-5", "1-3, 8" or "10-".
                maxPages:
                  type: integer
                  minimum: 1
                  description: Parse at most this many pages.
                includePages:
                  type: boolean
                  default: false
                  description: Return per-page Markdown in pages.
                pageMarkers:
                  type: boolean
                  default: false
                  description: Put <!-- page N --> before each page in markdown.
                prompt:
                  type: string
                  maxLength: 5000
                  description: Fields to extract, in plain words; the result is in json.
                schema:
                  type: object
                  description: JSON Schema for the extraction; the result is in json.
                dryRun:
                  type: boolean
                  default: false
                  description: Return pages and credits without parsing or charging.
                wait:
                  type: boolean
                  default: true
                  description: Wait up to 20 seconds for the result.
      responses:
        '202':
          description: Queued
          content:
            application/json:
              schema:
                type: object
                properties:
                  batchId:
                    type: string
                  documents:
                    type: array
                    items:
                      type: object
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.