Sign inGet Started

Upload an attachment

POST
/v1/amb/attachments
bird amb attachments upload --from <from> --file ./document.pdf
Resposta201
{
  "id": "aat_01krdgeqcxet5s7t44vh8rt9mg",
  "business_account_id": "abz_01krdgeqcxet5s7t44vh8rt9mg",
  "origin": "received",
  "message_id": "amb_01krdgeqcxet5s7t44vh8rt9mg",
  "name": "receipt.pdf",
  "mime_type": "application/pdf"
}

Uploads a file to Apple for the business account identified by from and returns an attachment you can send by attachment_id. Send the file as multipart/form-data with from and file, at most 25,000,000 bytes; or supply from and an HTTPS source_url, which Bird downloads, at most 99,999,999 bytes, as JSON or as multipart form fields. Bird encrypts and uploads the file to Apple before it responds.

The name is name, else the uploaded filename, else the last segment of the source_url path. The media type is mime_type, else the declared type of the uploaded file part, else the type Bird detects from the contents.

Each request uploads a new attachment, even for a file you uploaded before; retry with the same Idempotency-Key to receive the first result. expires_at is Bird's estimate of when Apple stops holding the attachment, 30 days after the upload or the last message that used it. An unknown from returns 404; a disconnected business account returns 422.

Corpo da requisição

from
string
obrigatório

Apple business identifier of the business account that sends the attachment. Read it from the business account's apple_business_id. Only this business account can send the attachment.

source_url
string
obrigatório

HTTPS URL of the file, at most 99,999,999 bytes. Bird downloads it and uploads it to Apple. A non-HTTPS URL is refused with a 422 AMBEndpointNotHTTPS.

name
string

Display filename. Defaults to the last segment of the source_url path.

mime_type
string

Media type of the file. Defaults to the type Bird detects from the contents.

Payload de resposta

id
string
obrigatório

Send it as attachment_id.

business_account_id
string
obrigatório

The business account Apple holds the attachment for.

origin
string
obrigatório

How Bird obtained an attachment:

  • received: A customer sent it in a message.
  • sent: You sent it in a message by source_url.
  • uploaded: You uploaded it with createAMBAttachment.

Possible values: received, sent, uploaded

message_id
string

The message the attachment belongs to.

name
string
obrigatório

Display filename. May be empty for an attachment stored before this release.

mime_type
string
obrigatório

Media type of the attachment. May be empty for an attachment stored before this release.

size
integer
obrigatório

Attachment size in bytes. May be 0 for an attachment stored before this release.

expires_at
string
obrigatório

Bird's estimate of when Apple stops holding the attachment, 30 days after it was received, uploaded or last sent. A send within 24 hours of this time is refused.

created_at
string
obrigatório

When Bird stored the attachment.