---
title: "Upload Document"
method: POST
path: "/extract/documents/upload"
tags: ["/extract"]
---

# Upload Document

`POST /extract/documents/upload`

## Request

- Base URL: `https://api.contextual.ai/v1`
- URL: `https://api.contextual.ai/v1/extract/documents/upload`
- Auth: HTTP bearer

Upload a document for structured extraction.

Uploads a PDF document that can be used for structured data extraction. Only PDF files are supported.

Supported File Types:

1. PDF files only (`.pdf` extension)
2. Maximum file size: 50MB (recommended)
3. Documents are processed and validated upon upload

Document Processing:

1. File size and page count are automatically calculated
2. Document is validated for PDF format and readability
3. Metadata is extracted and stored for future reference
4. Document is stored securely and can be referenced by ID

Usage:

After uploading, you'll receive a `document_id` that can be used with:

1. `POST /jobs` endpoint to start extraction jobs
2. `GET /documents/{document_id}` to retrieve document information
3. `DELETE /documents/{document_id}` to remove the document

Example Response:
```json
{
  "document_id": "123e4567-e89b-12d3-a456-426614174000",
  "file_name": "financial_report.pdf",
  "file_size": 2048576,
  "page_count": 45,
  "uploaded_at": "2025-01-11T18:35:00Z",
  "status": "uploaded"
}
```

## Request body `multipart/form-data`

- BodyUploadDocumentExtractDocumentsUploadPost
  - `file` string, binary, required

## Response `200`

Successful Response

- DocumentUploadResponse: Response model for document upload.
  - `document_id` string, required: Unique ID of the uploaded document
  - `file_name` string, required: Original filename of the uploaded document
  - `file_size` integer, required: File size in bytes
  - `page_count` integer, required: Number of pages in the document
  - `uploaded_at` string, required: Timestamp when the document was uploaded
  - `status` string, required: Upload status

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-16** `4abdda722de9`: 1 info
  - endpoint added
- **2026-01-13** `ca7f807eec8b`: 1 breaking
  - api path removed without deprecation
- **2025-10-28** `c8152db45500`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/contextualai/apis/endpoints/changes/extract/documents/upload/post.md)

---

[API](https://skmtc.dev/contextualai/apis/endpoints.md) - [All operations](https://skmtc.dev/contextualai/apis/endpoints/llms.txt) - [OpenAPI document](https://skmtc.dev/contextualai/apis/endpoints/revisions/4abdda722de9?raw)
