API referenceAttachments

Download an attachment's raw bytes

Returns the attachment's raw bytes on your API key, with Content-Type set to the stored MIME type (defaulting to application/octet-stream) and a Content-Disposition: attachment header carrying the original filename — the response body is the file itself, not a JSON envelope.

Endpoint
GET https://api.dairo.app/v1/attachments/{attachmentId}/download

Returns the attachment's raw bytes on your API key, with Content-Type set to the stored MIME type (defaulting to application/octet-stream) and a Content-Disposition: attachment header carrying the original filename — the response body is the file itself, not a JSON envelope. attachmentId is the UUID exposed as a message's attachments[].id; a malformed id returns 400 and an attachment your key can't reach returns 404. As the owner you can fetch your own inbound mail whether or not its attachment has finished its security scan, but a file the scan has flagged as unsafe is withheld with 403 — see handling untrusted attachments. To hand a file to a browser or a third party instead of proxying the bytes, mint a signed URL with the /url or /link variant.

Scope: messages:read. Send the API key as a bearer token; Scopes lists what each one reaches.

Request

cURL
curl "https://api.dairo.app/v1/attachments/3fa85f64-5717-4562-b3fc-2c963f66afa6/download" \
  -H "Authorization: Bearer $DAIRO_API_KEY"

Path parameters

NameTypeRequiredDescription
attachmentIdstring (uuid)yesThe attachment's ID.

Response

200 Success. Body: application/octet-stream, string (binary).

Errors

Every error has the same body, {"error": {"type", "code", "message", "param"}}; branch on code. Errors lists every code.

StatusMeaning
400The request is malformed or a value is invalid (invalid_request, invalid_domain, idempotency_key_mismatch).
401The API key is missing or invalid.
403The key lacks the scope this endpoint needs (scope_missing) or may not do this (not_permitted).
404No such resource in this account (resource_not_found).
429Rate limit, plan limit, budget or spend cap reached (rate_limited, plan_limit_reached, budget_exceeded, spend_cap_reached).
500An unexpected error; retry with backoff, then contact support (internal_error).

On this page