Skip to content

Attach a document to an order

Request

Attaches one document to a B2B order, whichever sales channel the order came from. The warehouse treats the document as uploaded by the merchant, the same as a document uploaded in the merchant portal (for example, an invoice is used as the merchant's commercial invoice).

Only the new document is written: the order itself is not changed, and documents already attached to the order are kept. Sending the same document again attaches it a second time.

The url in the response can be temporary while the file is being stored; list the order's documents to get its permanent download URL.

Orders that are not B2B are rejected with 422.

Security
BearerAuth
Path
idinteger, (int64)required

Order ID

Bodyapplication/jsonrequired
One of:

A document to attach to an order. Provide either document_data_uri or document_url.

document_data_uristring

Base64-encoded data URI of the document content, for example data:application/pdf;base64,.... Provide either this or document_url.

document_typestringrequired

Type of the document. gs1_label is not accepted here: GS1 labels belong to a logistic unit and are generated by the warehouse.

Enum:"delivery_slip""export_accompanying_document""invoice""order_confirmation""other""packing_label""packing_list""pallet_label""parcel_label""shipping_label"
document_urlstring

URL the document is downloaded from. Provide either this or document_data_uri.

namestring or null

Document filename

curl -i -X POST \
  'https://hive-merchant-api.redocly.app/_mock/merchant-api-v2/mapi_v2_oas31/orders/{id}/documents' \
  -H 'Authorization: Bearer <YOUR_token_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "document_type": "invoice",
    "document_data_uri": "data:application/pdf;base64,JVBERi0xLjcKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA1OTUgODQyXSA+PgplbmRvYmoKeHJlZgowIDQKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAp0cmFpbGVyCjw8IC9TaXplIDQgL1Jvb3QgMSAwIFIgPj4Kc3RhcnR4cmVmCjE4NgolJUVPRgo=",
    "name": "INV-1001.pdf"
  }'

Responses

Document attached to the order

Bodyapplication/json
document_typestring or nullrequired

Type of the document

Enum:"delivery_slip""export_accompanying_document""gs1_label""invoice""order_confirmation""other""packing_label""packing_list""pallet_label""parcel_label"
idinteger, (int64)required

Document ID

namestring or nullrequired

Document filename

urlstring or nullrequired

Document download URL

Response
{ "document_type": "delivery_slip", "id": 0, "name": "string", "url": "string" }