Media
3 endpoints in this family.
List received and sent files
GET/api/v1/media
Returns the files Nodium kept a copy of — images, videos, sounds and documents — most recent first. The file itself is downloaded with GET /messages/{messageId}/media.
Query parameters
kindstringOnly this family of files.
documentis everything that is not an image, a video or a sound.imagevideoaudiodocumentfromstringOnly files received or sent from this instant (ISO 8601).
tostringOnly files received or sent before this instant (ISO 8601).
limitintegerHow many to return.
cursorstringOpaque cursor from the previous page. Omit for the first page.
Response
A page of files and the cursor for the next one.
data.itemsobject[]The files, most recent first.
Show fields
messageIdstringThe message that carries the file.
conversationIdstringIts conversation.
directionstringReceived or sent.
inboundoutboundkindstringThe family of the file.
imagevideoaudiodocumentmimeTypestringIts media type;
nullwhen unknown.filenamestringIts name, when the sender gave one.
createdAtstringISO 8601.
data.nextCursorstringPass it as
cursorfor the next page;nullat the end.data.hasMorebooleanWhether another page exists.
data.totalintegerHow many match, on the first page only;
nullafter.
curl https://nodium.io/api/v1/media \ -H "Authorization: Bearer $NODIUM_KEY"{ "data": { "items": [ { "messageId": "…", "conversationId": "…", "direction": "inbound", "kind": "image", "mimeType": "…", "filename": "…", "createdAt": "…" } ], "nextCursor": "…", "hasMore": true, "total": 0 }}Upload a file to send
POST/api/v1/media
Uploads an image, video, audio file or document, as multipart/form-data, and returns a mediaId. Send it with POST /messages (type set to the returned kind).
The mediaId is valid for 7 days (expiresAt); after that, upload the file again. It belongs to the client you act on and can be sent to as many people as you like. Files are at most 4 MB. Nothing is sent to WhatsApp by this call: the file goes to Meta when you send it, from the number you choose.
Limited to 30 uploads per minute per key and client.
Body
filestringrequiredThe file itself, as a multipart part named
file.
Response
The `mediaId`, its kind, and when it expires.
data.mediaIdstringPass it as
mediaIdtoPOST /messages.data.kindstringThe
typeto send it with.imagevideoaudiodocumentdata.mimeTypestringIts media type.
data.filenamestringIts name, as uploaded.
data.sizeintegerIts size in bytes.
data.expiresAtstringISO 8601. Until then the
mediaIdcan be sent.
Refusals
- 422
file_missingNo file was sent, or it is empty. - 413
file_too_largeThe file is over 4 MB. - 415
file_type_refusedThis type of file cannot be sent on WhatsApp through Nodium. - 402
storage_quotaThe media storage included in your plan is full and your plan does not bill extra gigabytes. - 429
rate_limitedMore than 30 uploads in a minute for this key and client.
curl -X POST https://nodium.io/api/v1/media \ -H "Authorization: Bearer $NODIUM_KEY" \ -H "Content-Type: application/json" \ -d '{ "file": "…" }'{ "data": { "mediaId": "…", "kind": "image", "mimeType": "…", "filename": "…", "size": 0, "expiresAt": "…" }}Remove the file of a message
DEL/api/v1/media/{id}
Deletes the copy Nodium kept of the file. The message stays, with its text and its delivery data. The file cannot be recovered afterwards: WhatsApp deletes received media after seven days.
Path parameters
idstringThe id of the message that carries the file.
Response
Confirmation that the file is gone.
data.removedbooleanAlways
true.
Refusals
- 502
upstream_errorThe storage refused the deletion; nothing changed, try again.
curl -X DELETE https://nodium.io/api/v1/media/<id> \ -H "Authorization: Bearer $NODIUM_KEY"{ "data": { "removed": true }}