Sign inGet Started

Download an attachment

GET
/v1/amb/attachments/{attachment_id}/content
bird amb attachments download <attachment-id>

Downloads an attachment by its aat_ ID and returns its decrypted bytes with the media type the attachment declares. Bird checks the bytes only for a declared PNG, JPEG, GIF or WebP type: a declared raster type the bytes do not match returns application/octet-stream. Any other declared type is returned as declared, without a check that the bytes match it. A missing or malformed type returns application/octet-stream. The Content-Disposition header carries the file's name reduced to its base name, and no name when that is empty or longer than 200 characters, so choose your own filename when the header has none. The disposition is inline when the returned media type is image/jpeg, image/png, image/gif, image/webp, video/mp4, video/3gpp, audio/aac, audio/amr, audio/mpeg, audio/mp4 or audio/ogg, and attachment for every other type.

Bird serves a received attachment from the copy it makes when the message arrives, for 30 days from that moment, and never downloads it from Apple. While that copy is still arriving the request returns 425 with a Retry-After header; retry after that time. Once Bird has no copy, because it could not be made or the 30 days have passed, the request returns 410. Sending a received attachment again by its ID renews expires_at for sending only: the ID is still a received attachment, and its download window does not move.

Bird serves a file you uploaded from the copy it keeps, for 30 days from the upload, and never downloads it from Apple. A missing or expired copy returns 410, including after those 30 days while expires_at, which a later send renews, still allows sending the attachment. An outage of the storage holding the copy returns 503, which can be retried. A file uploaded before Bird kept a copy, or accepted without one, is downloaded from Apple like an attachment you sent, on this route and on the message attachment route alike.

An attachment you sent from a source_url is downloaded from Apple. Past expires_at, one that Apple no longer holds or refuses returns 410, while a timeout, rate limit or outage at Apple returns 503. Before expires_at, any failure to download from Apple returns 503. A 503 can be retried. An unknown ID returns 404.

Parametri

attachment_idstring

Attachment identifier. Starts with aat_.

Continua con la documentazione, le guide e gli esempi per questo argomento.