Files
List files
Newest first. Filter by purpose. Read only; it does not return the bytes.
Required scope: files:read.
query Parameters
limitcursorThe nextCursor of the previous page, with the same filters.
purposeOnly the files uploaded for this purpose.
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.
List files › Responses
Upload a file
Multipart, with the file in the file field and the purpose next to it. Upload once, then use the returned id as fileId in a message, a campaign or a template header: the file goes to WhatsApp for you when it is sent. The purpose sets the accepted types and sizes, which are the ones WhatsApp takes: message_media and campaign_media take JPEG and PNG images up to 5 MB, MP4 and 3GPP video up to 16 MB, and PDF, text, Word, Excel and PowerPoint documents up to 100 MB; template_header takes JPEG, PNG, MP4 and PDF samples. The type is read from the content, so a PNG sent as image/jpeg is rejected. A file only works where its purpose says: one uploaded for campaign_media is not accepted in a single message. Send contactId (with message_media) for a document that carries one person data, such as a statement: it can only be sent to that contact and it is erased with them. With dryRun=true it validates the file and the purpose, answers what it would return and stores nothing. Repeating the call with the same Idempotency-Key returns the first file.
Required scope: files:write.
query Parameters
dryRunWhen true, the request goes through the same validation as the real one and is answered with what would happen (always 200), and nothing is saved, sent or charged. The answer has the same shape as the real one plus dryRun: true; an id in it is not saved. It does not use the Idempotency-Key.
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.
Idempotency-KeyMakes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.
Upload a file › Request Body
filepurposecontactIdUpload a file › Responses
objectidUse it as fileId in a message, a campaign or a template header.
purposeWhat the file is for. message_media: the image, video or document of one WhatsApp message. campaign_media: the same, for a campaign. template_header: the sample file WhatsApp reviews in a template header. The purpose sets which types and sizes are accepted, and a file only works where its purpose says.
filenamemimeTypeThe type found in the content, not the one the client sent.
sizeBytessha256SHA-256 of the content, in hex.
contactIdThe contact the file is about, or null.
createdAtdryRunPresent and true when the request had dryRun=true.
Retrieve a file
Returns the record of one file: its purpose, type, size and hash. Use it to check a file before you send it. 404 not_found when the id does not exist, was deleted or belongs to another organization. Read only, so you can repeat it safely.
Required scope: files:read.
path Parameters
id^fil_[0-9A-Za-z]{22}… · requiredThe id of the file (fil_…).
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.
Retrieve a file › Responses
objectidUse it as fileId in a message, a campaign or a template header.
purposeWhat the file is for. message_media: the image, video or document of one WhatsApp message. campaign_media: the same, for a campaign. template_header: the sample file WhatsApp reviews in a template header. The purpose sets which types and sizes are accepted, and a file only works where its purpose says.
filenamemimeTypeThe type found in the content, not the one the client sent.
sizeBytessha256SHA-256 of the content, in hex.
contactIdThe contact the file is about, or null.
createdAtDelete a file
Deletes the stored file for good. Messages that already went out keep their record. If a campaign that has not finished or a message that has not gone out uses it, it answers 409 resource_in_use: cancel that campaign or wait, then delete again. Repeating the call returns 404 not_found, because the file no longer exists, so do not retry a 404 as a failure.
Required scope: files:write.
path Parameters
id^fil_[0-9A-Za-z]{22}… · requiredThe id of the file (fil_…).
Headers
Lelemon-Subaccount^sub_[0-9A-Za-z]{22}…The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.