انتقل إلى المحتوى الرئيسي

Upload an AI attachment's media

PUT 

/v1/agents/:agentId/attachments/:attachmentId/media

x-scope: "attachments:write"
x-rate-limit-per-minute: 10

The attachment's media as multipart/form-data, replacing whatever was stored: one file in file for a photo, video or document, or an album's images in files (up to 10, kept in order). Each file is checked by what it is, not by the type it is sent with:

  • photo, and each album image: JPEG, PNG or WebP, up to 5 MB (WhatsApp's limit for images, so a photo never uploads and then fails when the AI sends it);
  • video: MP4 or MOV, up to 16 MB. Every video is re-encoded on the server to the format WhatsApp plays (H.264, AAC, MP4) at up to 720p and 30 fps; one still over 16 MB after that, or one that takes longer than 150 seconds to re-encode, is refused;
  • document: PDF or DOCX, up to 20 MB.

A refused file is 422 invalid_media and changes nothing stored. The files stored before are removed, so messages the AI already sent with them no longer open their media in the conversation. This is the one endpoint whose body may be larger than 1 MB: up to 51 MB, a full album. Videos are re-encoded a few at a time across Mojeeb: when the server is busy for longer than 30 seconds, the answer is 503 media_processing_busy with Retry-After, and the same upload can be sent again. It shares the budget of 10 requests a minute per key with importAttachmentMedia and the other endpoints that have one. Uploading media doesn't switch the attachment on.

Request​

Responses​

The attachment with its new media.

Response Headers
    X-Correlation-ID

    Correlation id for this request — paste into support tickets.