Skip to main content
This article provides an overview of the attachment-related endpoints and functionality available for the HTTP Data API. Attachments consist of two distinct parts: metadata and a binary large object (blob) datastore. (See ATTACHMENT)

Uploading Attachments

Using the Multipart Form method, upload the raw binary contents of the file you want to attach:
There are no size limits for attachments in Ditto, but the HTTP API enforces a 1MB limit for uploading attachments. This can be increased upon request.
Curl

Downloading Attachments

Using /api/v5/attachments/{attachment_id}, download attachments:
Curl

When an Attachment Isn’t Available Yet

A document’s attachment token usually reaches Ditto Server before the blob does, because blob data transfers separately from document replication. While the blob is still transferring, the endpoint returns 404 Not Found:
Response
Retry the request with backoff. An ID that doesn’t exist produces the same response, so use a timeout to stop retrying a blob that never becomes available. Attachment IDs are a hash of the blob’s contents, so one blob can be referenced by many documents across collections. Download each attachment_id once and reuse it.

Download Responses

Range requests aren’t supported; a successful response always contains the complete blob.