Skip to content

Upload a document for printing ​

Upload a print-ready PDF or explicit RAW printer-language payload before creating a CloudPrint print job.

POST/api/v1/documentsAPI version: v1operationId: uploadDocumentView as Markdown

What this endpoint does ​

Upload a print-ready PDF or explicit RAW printer-language payload before creating a CloudPrint print job.

Authentication ​

Send a short-lived access token in Authorization: Bearer <access_token>.

Required scopes: documents:write

Request ​

Production base URL: https://public-api.cloudprint.me/api/v1/documents

Parameters ​

NameLocationTypeRequiredDescriptionConstraints
X-Request-IdheaderstringnoOptional request identifier for tracing; CloudPrint returns a safe value in the response header.maxLength: 128; example: "order-100045-attempt-1"

Request body ​

Content type: multipart/form-data

NameTypeRequiredDescriptionConstraints
filestring (binary)yesBinary PDF or RAW document uploaded as multipart form data.—
document_formatstring | nullnoExplicit print format, such as pdf or raw. Both formats use documents:write.enum: pdf, raw; example: "raw"
document_raw_languagestring | nullnoPrinter command language used by RAW data, for example ZPL or TSPL.enum: tspl, zpl, cpcl, escpos; example: "zpl"

Example requests ​

cURL ​

bash
curl -sS https://public-api.cloudprint.me/api/v1/documents \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -F "file=@shipping-label.pdf"

Response ​

HTTP status: 201 — Document uploaded

Response fields ​

NameTypeRequiredDescriptionConstraints
document_idstring (uuid)yesStable UUID returned after a successful document upload.—
original_filenamestringyesOriginal document filename recorded during upload.example: "invoice.pdf"
mime_typestringyesMIME type of the published installer or stored document.example: "application/pdf"
document_formatstringyesExplicit print format, such as pdf or raw. Both formats use documents:write.enum: pdf, raw; example: "pdf"
document_raw_languagestring | nullyesPrinter command language used by RAW data, for example ZPL or TSPL.enum: tspl, zpl, cpcl, escpos; example: null
size_bytesintegeryesStored document size in bytes.example: 1024

Example response ​

json
{
  "document_id": "11111111-1111-4111-8111-111111111111",
  "original_filename": "invoice.pdf",
  "mime_type": "application/pdf",
  "document_format": "pdf",
  "document_raw_language": null,
  "size_bytes": 1024
}

Errors ​

HTTP statusDescription
400Invalid upload request
401OAuth bearer token is missing or invalid
403OAuth bearer token does not include documents:write
413Uploaded file is too large
415Document format is not supported
422Document content, declared format, or upload request is invalid
429Rate limit exceeded
500Unexpected error
503Document security inspection is temporarily unavailable

Integration guidance ​

  • The existing documents:write scope covers PDF and RAW. For RAW printing, explicitly send document_format=raw and document_raw_language.
  • Convert DOC and DOCX to a print-ready PDF in your backend before uploading.
  • A 422 document rejection requires corrected input; retry a temporary inspection 503 with bounded backoff.
  • Keep the returned document_id for the subsequent print-job request.

Guides for integrating CloudPrint, connecting the local agent and operating print workflows.