Sign inGet Started

Get a message attachment

GET
/v1/amb/messages/{message_id}/attachments/{index}
bird amb attachment <message-id> <index>

Downloads the attachment at the zero-based index in a message's text.attachments array and returns its decrypted bytes with the media type the attachment declares. A declared PNG, JPEG, GIF or WebP type is kept only when the bytes match it; a missing, malformed or mismatched 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. Works for attachments a customer sent and for attachments you sent. For a received attachment, message_id is the message.id of the amb.received webhook event, and index is the attachment's position in that message's text.attachments array.

Bird serves a received attachment from the copy it makes when the message arrives, for 30 days from that moment. While the 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 30 days have passed, the request returns 410.

An attachment you sent is downloaded from Apple, which retains it for about 30 days; one Apple no longer holds returns 503. An unknown message or index returns 404.

Parameter

message_idstring

Message identifier. Starts with amb_. For a received attachment, use the message.id from the amb.received webhook event.

indexinteger

Zero-based position in the message's text.attachments array.

Weiter mit der Dokumentation, Anleitungen und Beispielen zu diesem Thema.