# OR74 - Upload documents to attach to an order

Description


    Documents filenames must be distinct. Only documents of the following types are supported: csv, doc, xls, xlsx, ppt, pdf, odt, ods, odp, txt, rtf, png, jpg, gif, zpl, mov, mp4.
An order can have a maximum of 50 documents.
    In the API output we include only documents with errors. All other documents are successfully uploaded.

For system document types, there are specific restrictions :

    SYSTEM_DELIVERY_BILL/SYSTEM_SHIPMENT_DELIVERY_BILL : restricted to operator role.
    SYSTEM_MESSAGE_ATTACHMENT : cannot be directly uploaded to an order.




Call Frequency

Recommended usage: At each document upload on an order
Maximum usage: At each document upload on an order
Read More

More context

Endpoint: POST /api/orders/{order_id}/documents

## Path parameters:

  - `order_id` (string, required)
    The identifier of the order

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

  - `files` (array, required)
    The files to be uploaded. Use multipart/form-data with name 'files'. The file names must contain only US-ASCII characters.

  - `order_documents` (object, required)
    The list of documents to be uploaded details

  - `order_documents.order_documents` (array, required)

  - `order_documents.order_documents.entity` (object)
    Document entity. Should only be used with the return feature and not for any other kind of documents.

  - `order_documents.order_documents.entity.id` (string, required)
    Document entity ID

  - `order_documents.order_documents.entity.type` (string, required)
    Document entity
    Enum: "RETURN"

  - `order_documents.order_documents.file_name` (string, required)
    File name

  - `order_documents.order_documents.type_code` (string, required)
    Document type code

## Response 200 fields (application/json):

  - `errors_count` (integer)
    The number of documents in an error state

  - `order_documents` (array, required)
    Lists of error reports associated to each document in an error state

  - `order_documents.errors` (array, required)
    Errors about the input object

  - `order_documents.errors.code` (string, required)
    Error code

  - `order_documents.errors.field` (string, required)
    Name of the field on the input object. Can be composed, e.g.: address.zip_code

  - `order_documents.errors.message` (string, required)
    Error message

  - `order_documents.input` (object)
    Invalid order document that was received from caller.

  - `order_documents.input.file_name` (string)

  - `order_documents.input.type_code` (string)


