# Request an invoice document upload

Creates a pending invoice document and returns a presigned upload request.
Upload the document with every returned `upload_headers` entry, including
`Content-Type` (the requested `filetype`), wait until
`GET /invoices/documents/{merchant_invoice_document_id}` reports `accepted`, then use
`document_id` as `merchant_invoice_document_id` when creating or updating the invoice.

Endpoint: POST /invoices/documents
Version: V5
Security: bearerAuth, basicAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer JWT

  - `basicAuth` (unknown)
    http basic

## Request body:

  - `application/json` (unknown)
    Document metadata used to request an invoice upload.

## Request fields (application/json):

  - `filename` (string, required)
    Original filename. The extension must match filetype.
    Example: invoice.pdf

  - `filetype` (string, required)
    MIME type of the invoice document.
    Enum: "application/pdf", "image/png", "image/jpeg", "image/jpg"

## Response 200:

  - `200` (unknown)
    Pending invoice document upload request.

## Response 200 fields (application/json):

  - `id` (string, required)

  - `document_id` (string, required)
    Use as merchant_invoice_document_id after validation succeeds.

  - `url` (string, required)

  - `upload_url` (string, required)

  - `upload_expires_at` (string, required)

  - `object_key` (string, required)

  - `transfer_method` (string, required)
    Enum: "presigned_upload"

  - `upload_headers` (object, required)

  - `validation_profile` (string, required)
    Enum: "merchant_invoice_document_default"

## Response 400:

  - `400` (unknown)
    Bad request error

## Response 400 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Validation error

  - `error.type` (string)
    A short string, describing error type
    Enum: "validation_error"

  - `error.details` (array)

  - `error.details.path` (string)
    Path to the field failed validation
    Example: path.to.field

  - `error.details.message` (string)
    Detailed description of the error
    Example: `[field]` is required

## Response 401:

  - `401` (unknown)
    Unauthorized error

## Response 401 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Invalid merchant credentials

  - `error.type` (string)
    A short string, describing error type
    Enum: "authentication_error"

## Response 429:

  - `429` (unknown)
    Rate limit error

## Response 429 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Too many requests

  - `error.type` (string)
    A short string, describing error type
    Enum: "rate_limit_error"

