# Create a new document

Uploads a file and returns a document record you can reference from other resources — as the invoice
or supporting paperwork on a payin or payout, or as evidence when responding to a request for
information (RFI).
Send the request as `multipart/form-data`. The file must be a JPEG, PNG or PDF of at most 10 MB
(10,485,760 bytes), and the uploaded filename and `document_name` at most 128 characters each.
Upload is a separate step from attaching, and each consumer names the reference differently: pass the
returned `id` as `document_id` when creating a payin, an order or a refund, and inside the `documents`
array when creating a payout or responding to an RFI. Check the schema of the endpoint you are
attaching to — the key inside `documents` is not the same on every one. A document that is never
referenced stays listed but has no effect.

Endpoint: POST /document
Version: 1.0.0
Security: JWT

## Security:

  - `JWT` (unknown)
    http bearer JWT

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

  - `document_name` (string, required)
    The name of the document
    Example: invoice

  - `file` (string, required)
    The file to be uploaded. This should be sent as a binary in the multipart/form-data request.

## Response 201:

  - `201` (unknown)
    Document created successfully

## Response 201 fields (application/json):

  - `id` (string)
    The unique identifier for the Document.
    Example: doc_nYUqLpuYQ0M8

  - `document_name` (string)
    The name of document
    Example: invoice

  - `file_name` (string)
    The name of the file you uploaded.
    Example: invoice_BC8tFdE.pdf

  - `preview_url` (string)
    The URL to preview the document.
    Example: https://glomopay-service-staging-documents.s3.ap-south-1.amazonaws.com/12345_invoice

  - `status` (string)
    The status of file you uploaded. Values can be uploaded, approved and rejected.
    Example: uploaded

  - `created_at` (string)
    When the document was created, as an ISO 8601 date-time in UTC.
    Example: 2021-06-01T12:00:00Z

  - `updated_at` (string)
    When the document was last updated, as an ISO 8601 date-time in UTC.
    Example: 2021-06-01T12:00:00Z

## Response 400:

  - `400` (unknown)
    Bad request

