Inbound Emails
Download Attachment
Retrieves a single attachment from an inbound message, referenced by its attachmentId or zero-based index. By default returns JSON metadata with a short-lived pre-signed download URL; pass download=true to stream the raw attachment bytes with the appropriate Content-Type and Content-Disposition headers.
GET
This endpoint uses a standard project API key (
AS_ prefix). It returns a single attachment from an inbound message, identified either by its attachmentId (recommended, stable) or by its zero-based index from the message’s attachments array.By default it returns JSON metadata with a short-lived, pre-signed download URL. Pass ?download=true to stream the raw bytes instead, with Content-Type and Content-Disposition: attachment; filename="…" headers.Authorizations
Project API key header of the form Bearer
as_<key>. You can also pass the key via the x-api-key header.Path Parameters
The unique identifier of the inbound message. The message must belong to the authenticated project.Example:
"60d5ec49f1b2c72d9c8b1234"Identifies the attachment. Accepts either the attachment’s
attachmentId (recommended, stable across requests, e.g. att_60d5ec49f1b2c72d9c8b9999) or a zero-based index into the message’s attachments array (back-compat, e.g. 0).Example: att_60d5ec49f1b2c72d9c8b9999Query Parameters
Controls the response format.
false(default): returns JSON metadata with a short-lived, pre-signeddownloadUrl.true: streams the raw attachment bytes withContent-TypeandContent-Dispositionheaders.
Response
Attachment metadata retrieved successfully. With?download=true, the body is instead the raw binary content and the Content-Type and Content-Disposition response headers describe the file.
Indicates if the request was successfulExample:
trueAttachment metadata and download URL
Error Responses
Returned when
id is not valid or idx is neither a non-negative integer nor a valid attachmentId.Returned when the message does not exist or does not belong to the authenticated project.
Returned when no attachment matches the given
attachmentId or index.Returned when the message’s raw MIME source is not yet stored (the message may still be processing), so the attachment cannot be produced.
Returned when an unexpected error occurs while producing the download URL or streaming the attachment.