# Create document

Upload a new document to Anesya using a multipart file upload.

Related endpoints:

* List documents
* Retrieve document
* Create parsing

Endpoint: POST /v0/documents
Security: ApiKeyAuth

## Query parameters:

  - `pdf_page_start` (integer)
    Optional first PDF page to keep when trimming an uploaded PDF.

  - `pdf_page_end` (integer)
    Optional last PDF page to keep when trimming an uploaded PDF.

## Request fields (multipart/form-data):

  - `filename` (string)
    Optional filename override. Defaults to the uploaded file name.
    Example: "invoice.pdf"

  - `file` (string, required)
    Document file to upload.

  - `metadata` (object,null)
    Example: {"source":"api"}

## Response 201 fields (application/json):

  - `id` (string, required)
    Example: "300f339f-da71-4f9f-80f6-c25a63baae75"

  - `filename` (string, required)
    Example: "invoice.pdf"

  - `file_url` (string,null)
    Example: "/v0/documents/300f339f-da71-4f9f-80f6-c25a63baae75/download"

  - `metadata` (object, required)
    Example: {"source":"api"}

  - `page_count` (integer, required)
    Example: 3

  - `created_at` (string, required)
    Example: "2025-06-12T14:56:10.682461Z"

  - `updated_at` (string, required)
    Example: "2025-06-12T14:56:10.682461Z"

## Response 401 fields (application/json):

  - `detail` (string, required)
    Example: "Invalid API key"


