# POST /v2/parse

> Upload a PDF, an Office file or an image and get its text back. An image is read by OCR, only with the image parser on.

POST `/v2/parse`

**Authentication:** your key as a [bearer token](https://darkcrawl.dev/docs/api-reference/authentication/).

## Body

| Field               | Type                   | Required | Default        |
| ------------------- | ---------------------- | -------- | -------------- |
| `file`              | `file`                 | Required |                |
| `options`           | `object`               | Optional |                |
| `options.formats`   | `(string \| object)[]` | Optional | `["markdown"]` |
| `options.timeout`   | `integer \| null`      | Optional | `30000`        |
| `options.parsers`   | `(string \| object)[]` | Optional |                |
| `options.redactPII` | `boolean \| object`    | Optional |                |

Firecrawl compatibility fields

Firecrawl fields DarkCrawl does not offer. It takes them so the Firecrawl SDKs keep working, then ignores or refuses each one as the table says.

| Field                         | What DarkCrawl does                                   |
| ----------------------------- | ----------------------------------------------------- |
| `options.onlyMainContent`     | Ignored, with a warning when not Firecrawl's default. |
| `options.includeTags`         | Ignored, with a warning when not Firecrawl's default. |
| `options.excludeTags`         | Ignored, with a warning when not Firecrawl's default. |
| `options.mobile`              | Ignored, with a warning when not Firecrawl's default. |
| `options.blockAds`            | Ignored, with a warning when not Firecrawl's default. |
| `options.fastMode`            | Ignored, with a warning when not Firecrawl's default. |
| `options.origin`              | Accepted and ignored.                                 |
| `options.skipTlsVerification` | Accepted and ignored.                                 |
| `options.removeBase64Images`  | Accepted and ignored.                                 |

## Request

```bash
curl -X POST https://api.darkcrawl.dev/v2/parse \
  -H "Authorization: Bearer $DARKCRAWL_API_KEY" \
  -F "file=@<your file>" \
  -F 'options={"formats":["markdown","links"]}'
```

## Response

Status `200`.

```json
{
  "success": true,
  "data": {
    "markdown": "# Sample report\n\nPage one of a fictional PDF.\n",
    "indicators": [],
    "metadata": {
      "title": "Sample report",
      "numPages": 1,
      "totalPages": 1,
      "sourceFile": "report.pdf",
      "contentType": "application/pdf",
      "document": {
        "type": "pdf",
        "pages": 1,
        "totalPages": 1,
        "ocrPages": 0,
        "truncated": false,
        "encrypted": false
      }
    }
  }
}
```

## Errors

| Code                     | Status |
| ------------------------ | ------ |
| `BAD_REQUEST`            | 400    |
| `NOT_IMPLEMENTED`        | 400    |
| `POLICY_FORBIDDEN`       | 400    |
| `SCRAPE_TIMEOUT`         | 408    |
| `PAYLOAD_TOO_LARGE`      | 413    |
| `EXTRACTION_FAILED`      | 422    |
| `AI_UNAVAILABLE`         | 503    |
| `BLOCKLIST_UNAVAILABLE`  | 503    |
| `EXTRACTION_UNAVAILABLE` | 503    |

What each code means, and what to do about it: [Errors](https://darkcrawl.dev/docs/api-reference/errors/).

## Notes

- The request is `multipart/form-data`: a `file` part and, optionally, an `options` part that holds JSON.
- Any other `options` field answers `400 BAD_REQUEST`. What is read, and the limits, are on [Parse](https://darkcrawl.dev/docs/endpoints/parse/).
