# v2-uploadOrderDocument - Upload a document for an order

Description

Use this API to upload a document for an order or its related entities (e.g. returns).

Supported document types are :
  - RETURN_LABEL
  - CUSTOMER_INVOICE



Call Frequency

Recommended usage: On each document upload
Maximum usage: On each document upload

Endpoint: POST /v2/orders/{order_id}/documents
Security: Bearer

## Path parameters:

  - `order_id` (string, required)
    Order identifier in Mirakl Connect
    Example: "0024_COMMERCIAL_ID-A"

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

  - `file` (string, required)
    The document file to upload.

Maximum file size: 10 MB.

Supported formats are :
  - PDF
  - JPEG
  - PNG
  - CSV

  - `metadata` (object, required)

  - `metadata.entity` (object)
    The entity this document is associated with.
Required when type is : 
  - RETURN_LABEL

  - `metadata.entity.id` (string, required)
    The id of the entity (e.g. returnId for entity_type : RETURN) this document is associated with.

  - `metadata.entity.type` (string, required)
    The type of entity this document is associated with.
    Enum: "RETURN"

  - `metadata.filename` (string, required)
    Name of the document (only this field counts as the file name).
We recommend including a way to distinguish the document type in this field.

  - `metadata.type` (string, required)
    Type of the document
    Enum: "RETURN_LABEL", "CUSTOMER_INVOICE", "DELIVERY_SLIP", "SHIPMENT_DELIVERY_SLIP", "CHANNEL_SPECIFIC"

## Response 202 fields (application/json):

  - `action_id` (string, required)
    The unique identifier for the asynchronous action. It should be used with the [v2-getActionStatus API](#operation/v2-getActionStatus) to retrieve current action status and potential errors.

  - `tracking_id` (string)
    Deprecated: This field was previously used to obtain the action ID. It has been replaced by action_id and contains the same value. It is retained for backward compatibility.

## Response 400 fields (application/json):

  - `code` (string, required)
    Error code (immutable)

  - `errors` (array)

  - `errors.extensions` (object)
    Free map where you find additional context data to better describe the error

  - `errors.field` (string)
    JsonPath to the field where the error occurred

  - `errors.message` (string, required)
    Literal string error item description (Please do not base your error handling on this field since it is subject to change)

  - `extensions` (object)
    Free map where you find additional context data to better describe the error

  - `message` (string, required)
    Literal string error description (Please do not base your error handling on this field since it is subject to change)

## Response 404 fields (application/json):

  - `code` (string, required)
    Error code (immutable)

  - `errors` (array)

  - `errors.extensions` (object)
    Free map where you find additional context data to better describe the error

  - `errors.field` (string)
    JsonPath to the field where the error occurred

  - `errors.message` (string, required)
    Literal string error item description (Please do not base your error handling on this field since it is subject to change)

  - `extensions` (object)
    Free map where you find additional context data to better describe the error

  - `message` (string, required)
    Literal string error description (Please do not base your error handling on this field since it is subject to change)


