# Documents

> Upload files to your workspace and process them with Parsings and Operations.

A **Document** is a file uploaded to your workspace. It keeps the original file and its metadata, and any number of [Parsings and Operations](https://docs.axelered.com/jobs_guide) can process it.

* **Retention**: a Document is deleted 30 days after upload, together with its Parsings, Operations and their outputs.
* **Size**: up to 10 MB per file.
* **Pages**: `accurate` Parsing of PDFs, images and presentations reads at most 100 pages per Job, counting only the selected `pages`. Over the limit the Job is rejected with `413 too_many_pages`: select fewer `pages`, or use `fast` Parsing, which has no limit.
* **Type detection**: the type is detected from the content. A file whose extension does not match its content is rejected with `400 unsupported_format`.

***

## 📂 Supported File Types

| Type       | Formats                                                                            |
| :--------- | :--------------------------------------------------------------------------------- |
| **PDF**    | `.pdf`                                                                             |
| **Office** | `.docx`, `.doc`, `.xlsx`, `.xls`, `.pptx`, `.ppt`, `.odt`, `.ods`, `.odp`          |
| **Images** | `.jpg`, `.jpeg`, `.png`, `.webp`, `.tiff`, `.tif`, `.bmp`, `.gif`, `.avif`, `.svg` |
| **Text**   | `.txt`, `.md`, `.html`, `.htm`, `.csv`, `.json`                                    |

***

## 🛠️ Document Management

For every field and parameter, see the [**Documents reference**](https://docs.axelered.com/reference#documents).

### [Upload a Document](https://docs.axelered.com/reference/documents/api_create_documents_post)

Send the file as multipart form data. `name` defaults to the filename.

```bash
curl -X POST "https://api.axelered.com/v1/documents" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@/path/to/invoice.pdf"
```

You can also skip this step and send the file directly when you [submit a Parsing or an Operation](https://docs.axelered.com/jobs_guide).

### List, Read & Update

* [**List Documents**](https://docs.axelered.com/reference/documents/api_list_documents_get): newest first.
* [**Read Document**](https://docs.axelered.com/reference/documents/api_read_documents__document_id__get): the metadata of a Document.
* [**Update Document**](https://docs.axelered.com/reference/documents/api_update_documents__document_id__patch): change the name. The file itself cannot change.
* [**Download Document**](https://docs.axelered.com/reference/documents/api_original_documents__document_id__original_get): the original file.

### [Delete a Document](https://docs.axelered.com/reference/documents/api_delete_documents__document_id__delete)

The Document, its Parsings and its Operations are hidden immediately, and their files are removed shortly after.

```bash
curl -X DELETE "https://api.axelered.com/v1/documents/{document_id}" \
  -H "Authorization: Bearer YOUR_API_KEY"
```
