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

# Upload Invoice

> POST /api/upload

Upload a PDF or image file for invoice extraction.

## Endpoint

```
POST /api/upload
```

## Request

**Content-Type**: `multipart/form-data`

### Body Parameters

| Parameter  | Type   | Required | Description                  |
| ---------- | ------ | -------- | ---------------------------- |
| `file`     | File   | Yes      | PDF or image file (max 10MB) |
| `clientId` | string | No       | Assign to a specific client  |

### Example

```bash theme={null}
curl -X POST https://vatextract.com/api/upload \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@invoice.pdf" \
  -F "clientId=client_abc123"
```

## Response

```json theme={null}
{
  "id": "inv_abc123xyz",
  "status": "processing",
  "fileName": "invoice.pdf",
  "createdAt": "2024-01-15T10:30:00Z"
}
```

### Response Fields

| Field       | Type   | Description                            |
| ----------- | ------ | -------------------------------------- |
| `id`        | string | Unique invoice ID                      |
| `status`    | string | `processing`, `completed`, or `failed` |
| `fileName`  | string | Original filename                      |
| `createdAt` | string | ISO 8601 timestamp                     |

## Processing Status

After upload, the invoice is processed asynchronously. Check status by fetching the invoice:

```bash theme={null}
GET /api/invoices/inv_abc123xyz
```

| Status       | Description                                     |
| ------------ | ----------------------------------------------- |
| `processing` | OCR extraction in progress                      |
| `completed`  | Extraction finished, data available             |
| `failed`     | Extraction failed (see `textractFailureReason`) |

<Info>
  Processing typically takes 5-15 seconds. VAT validation happens asynchronously after extraction completes.
</Info>

## Supported Formats

| Format | Max Size | Notes                       |
| ------ | -------- | --------------------------- |
| PDF    | 10MB     | Native and scanned          |
| JPEG   | 10MB     | High resolution recommended |
| PNG    | 10MB     | High resolution recommended |

## Error Responses

| Status | Error               | Description                |
| ------ | ------------------- | -------------------------- |
| 400    | `No file provided`  | Missing file in request    |
| 400    | `Invalid file type` | Unsupported format         |
| 413    | `File too large`    | Exceeds 10MB limit         |
| 401    | `Unauthorized`      | Invalid/missing auth token |

## Bulk Upload

Need to process many invoices at once? Use the bulk upload endpoint to submit a ZIP file containing multiple PDFs and images.

```
POST /api/upload/bulk
```

See the [Bulk Upload feature guide](/features/bulk-upload#bulk-upload-via-api) for full API details including signed URL upload flow and response format.
