Documents API
v1Create document records and upload files, then attach them to orders — delivery notes, customs papers, invoices, and any other paperwork that must travel with an order.
A document in Zendera is an uploaded file (PDF, image, spreadsheet, …) that can be attached to orders — delivery notes, customs papers, invoices, packing lists. Drivers see attached documents in the mobile app, and dispatchers see them in the web application.
Where this fits in your operation
Paperwork that must travel with the goods enters Zendera here:
- Your ERP generates a delivery note or customs invoice when an order is confirmed — upload it and attach it so the driver has it at the stop.
- A packing list from your WMS is attached after picking completes, before dispatch.
- When paperwork is replaced (corrected invoice), attach with
REPLACE_SAME_NAMEso the order always carries the current version.
The integration flow has three steps:
POST /v1/documents— create the document record; the response contains a one-time upload URL and a long-lived download URL.- Upload the file bytes with an HTTP
PUTto theupload_url. POST /v2/orders/attach-documents— attach the document to an order or draft by ID (documented on the Orders API page).
Interactive API Explorer
Loading API Documentation...
Authentication
Authorization: apikey YOUR_API_KEY_HEREBase URLs
- Production:
https://app.zenderatms.com/api/ - Staging:
https://staging.zenderatms.com/api/
Create a document
POST /v1/documents
{
"name": "Delivery note ERP-001",
"extension": "pdf",
"description": "Signed delivery note for order ERP-001",
"tags": [{ "tag": "delivery-note" }]
}| Field | Notes |
|---|---|
extension | Required. File extension without the dot (pdf, png, xlsx, …). Creation is rejected without it. |
name | Optional display name. |
description | Optional free text. |
tags | Optional array of { "tag": "..." } objects for categorisation. Only the tag value is used on create. |
Response:
{
"document_id": 101,
"name": "Delivery note ERP-001",
"description": "Signed delivery note for order ERP-001",
"extension": "pdf",
"upload_url": "https://storage.googleapis.com/...&upload_id=...",
"download_url": "https://storage.googleapis.com/...?<signed>"
}| Field | Notes |
|---|---|
document_id | The stable ID you reference in attach-documents. |
upload_url | A pre-initiated upload session URL. Upload promptly after creating the document. |
download_url | A signed read URL, valid for about a year. Re-host the file on your side if you need it longer. |
This endpoint uses snake_case JSON (document_id, upload_url) — it is a v1 endpoint and follows the older convention. The v2 attach-documents endpoint uses camelCase (documentIds). Don’t let your serializer assume one convention across both.
Upload the file
The upload_url is a ready-to-use upload session (Google Cloud Storage resumable session, already initiated by the backend). Send the file bytes with a single PUT:
curl -X PUT \
--upload-file ./delivery-note.pdf \
"<upload_url>"No authentication header is needed on this request — the URL itself carries the authorisation. A 200 OK means the file is stored.
Attach to an order
Once uploaded, attach the document by ID:
POST /v2/orders/attach-documents
{
"externalId": "ERP-001",
"documentIds": [101],
"attachBehavior": "APPEND"
}See the Orders API documents section for the full request/response reference, including the REPLACE_ALL and REPLACE_SAME_NAME behaviors.
Common gotchas
- Create, upload, then attach — in that order. Attaching a
document_idwhose file was never uploaded gives you an attachment with no content behind it. extensionis mandatory on create; the call fails without it.- Upload promptly. The upload session is meant to be used right after creation — don’t store
upload_urlfor later. - No list/download-by-id endpoint is exposed to API keys. Keep your own record of
document_idanddownload_urlfrom the create response. - Documents are organization-scoped. You can only attach documents created under your own organization’s API key.