Documents
Documents Overview
Documents provide structured file storage for any platform resource. Use the Documents API to attach files to shipments, assets, fulfillments, and other objects, controlling whether each file is publicly readable or restricted to signed URLs.
What Documents Do
- Store files in Google Cloud Storage with a deterministic path scoped to your organization.
- Track upload status so you can create a document record before the file arrives.
- Link a single document to multiple resources, and query documents by the resource they're linked to.
- Switch between world-readable public files and time-limited private signed URLs per document.
Use Cases
Proof of delivery — Attach a POD photo or signature to a shipment. Mark it public so the recipient can view it without authentication.
Invoices and contracts — Attach billing documents to fulfillments. Keep them private and generate signed URLs on demand for authorized users.
Spec sheets and manuals — Link product documents to items. One document can be linked to many items.
Customs and shipping forms — Attach bill-of-lading or customs declarations to manifests.
Upload Modes
Documents support two upload modes.
Sync upload — Include the file as a base64 data-URI in the content field. The API uploads to GCS immediately and returns the document with upload_status: "completed". Best for small files or when the caller already has the file in memory.
Async upload — Omit content and provide mime_type instead. The API creates a requested record and returns a signed GCS PUT URL. The client PUTs the file bytes directly to GCS (no API key needed), then calls the update endpoint to trigger verification. Best for large files or browser-based uploads.
Object IDs
- Document IDs are prefixed with
dcmt_ - Document link IDs are prefixed with
dlk_