Media
Upload files to send, download attachments, media library. · 13 endpoints
- GET/accounts/{accountId}/conversations/{threadId}/messages/{msgId}/media
- POST/media/uploads
- DELETE/media/uploads/{uploadId}
- GET/accounts/{accountId}/library/items
- POST/accounts/{accountId}/library/items
- PATCH/library/items/{uuid}
- DELETE/library/items/{uuid}
- GET/library/items/{uuid}/file
- GET/library/items/{uuid}/thumb
- GET/accounts/{accountId}/library/folders
- POST/accounts/{accountId}/library/folders
- PATCH/accounts/{accountId}/library/folders/{folderId}
- DELETE/accounts/{accountId}/library/folders/{folderId}
Download a message's file/photo/video/voice recording (downloaded to the machine first if it isn't there yet)
GET
/api/v1/accounts/{accountId}/conversations/{threadId}/messages/{msgId}/mediaScope: media:readParameters
accountIdpath · required | string max 200 | Account ID |
threadIdpath · required | string max 200 | Conversation ID |
msgIdpath · required | string max 200 | Message ID (msg_id) |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/conversations/{threadId}/messages/{msgId}/media" \
-H "Authorization: Bearer dpk_xxx"Upload a file to send in chat (returns an upload_id that expires after 24 hours)
POST
/api/v1/media/uploadsScope: media:writeTwo ways to send it:
- Raw body: header
X-Filename: ten-file.pdf(URL-encode it if it contains diacritics) + the file'sContent-Type. Written straight to disk. multipart/form-datawith afilefield. Only the key that uploaded the file can use the upload_id.
multipart/form-data body
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/media/uploads" \
-H "Authorization: Bearer dpk_xxx"Delete an uploaded file (without waiting for it to expire)
DELETE
/api/v1/media/uploads/{uploadId}Scope: media:writeParameters
uploadIdpath · required | string max 100 |
Example request
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/media/uploads/{uploadId}" \
-H "Authorization: Bearer dpk_xxx"Items in the account's media library
GET
/api/v1/accounts/{accountId}/library/itemsScope: media:readParameters
accountIdpath · required | string max 200 | Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID. |
typequery · optional | "all" | "image" | "video" | "file" | "audio" default "all" | |
searchquery · optional | string max 200 | |
folder_idquery · optional | integer | -1 = not in any folder |
pagequery · optional | integer ≥ 1 · default 1 | |
limitquery · optional | integer ≥ 1 · ≤ 200 · default 50 |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/items" \
-H "Authorization: Bearer dpk_xxx"Add an uploaded file to the library
POST
/api/v1/accounts/{accountId}/library/itemsScope: media:writeParameters
accountIdpath · required | string max 200 | Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID. |
Request body (JSON)
upload_idrequired | string | |
nameoptional | string max 200 | |
tagsoptional | string max 500 · default "" | |
folder_idoptional | integer | null |
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/items" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"upload_id":"string","name":"string","tags":""}'Change the name, tags, folder, favorite
PATCH
/api/v1/library/items/{uuid}Scope: media:writeParameters
uuidpath · required | string max 100 |
Request body (JSON)
nameoptional | string max 200 | |
tagsoptional | string max 500 | |
folder_idoptional | integer | null | |
is_favoriteoptional | boolean | |
alt_textoptional | string max 500 |
Example request
bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/library/items/{uuid}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","tags":"string","folder_id":0}'Delete an item from the library
DELETE
/api/v1/library/items/{uuid}Scope: media:writeParameters
uuidpath · required | string max 100 |
Example request
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/library/items/{uuid}" \
-H "Authorization: Bearer dpk_xxx"Download the item's file
GET
/api/v1/library/items/{uuid}/fileScope: media:readParameters
uuidpath · required | string max 100 |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/library/items/{uuid}/file" \
-H "Authorization: Bearer dpk_xxx"The item's thumbnail
GET
/api/v1/library/items/{uuid}/thumbScope: media:readParameters
uuidpath · required | string max 100 |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/library/items/{uuid}/thumb" \
-H "Authorization: Bearer dpk_xxx"Library folders
GET
/api/v1/accounts/{accountId}/library/foldersScope: media:readParameters
accountIdpath · required | string max 200 | Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID. |
typequery · optional | string max 20 |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/folders" \
-H "Authorization: Bearer dpk_xxx"Create a folder
POST
/api/v1/accounts/{accountId}/library/foldersScope: media:writeParameters
accountIdpath · required | string max 200 | Account ID (accounts.zalo_id). Facebook uses the Facebook ID, Telegram uses the Telegram account ID. |
Request body (JSON)
namerequired | string max 200 | |
coloroptional | string max 20 |
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/folders" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","color":"string"}'Rename a folder
PATCH
/api/v1/accounts/{accountId}/library/folders/{folderId}Scope: media:writeParameters
accountIdpath · required | string max 200 | |
folderIdpath · required | integer ≥ 1 |
Request body (JSON)
namerequired | string max 200 |
Example request
bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/folders/{folderId}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string"}'Delete a folder (files inside are moved out, not deleted)
DELETE
/api/v1/accounts/{accountId}/library/folders/{folderId}Scope: media:writeParameters
accountIdpath · required | string max 200 | |
folderIdpath · required | integer ≥ 1 |
Example request
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/library/folders/{folderId}" \
-H "Authorization: Bearer dpk_xxx"