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

# Uploads

> Request a presigned upload URL, upload the file directly, then reference the upload ID when creating a run.

# Uploads

> Docex uses presigned upload URLs to keep large files out of API request bodies. Your client uploads directly to storage, then references the upload ID when creating a run.

## Presign an upload

```bash theme={null}
POST /v1/uploads/presign
```

### Headers

<ParamField header="x-api-key" type="string" required>
  Your Docex API key.
</ParamField>

### Body

<ParamField body="fileName" type="string" required>
  Original file name including extension.
</ParamField>

<ParamField body="contentLength" type="number" required>
  File size in bytes.
</ParamField>

### Response

```json theme={null}
{
  "uploadId": "ul_abc123",
  "uploadUrl": "https://..."
}
```

## Upload the file

```bash theme={null}
PUT <uploadUrl>
Content-Type: application/octet-stream

<raw-file-bytes>
```

The upload URL is time-limited. Upload immediately after presigning.

## Supported file types

| Extension       | Type     |
| --------------- | -------- |
| `.jpg`, `.jpeg` | Image    |
| `.png`          | Image    |
| `.heic`         | Image    |
| `.pdf`          | Document |

## SDK example

```js theme={null}
const docex = createDocex({ apiKey, baseUrl });

// The SDK handles presign + upload automatically:
const result = await docex.run({
  file: "./invoice.pdf",     // SDK reads file, presigns, uploads
  prompt: "Extract line items, totals, and vendor details",
});
```
