/api/decrypt-media
This endpoint is used to decrypt media files sent in messages. You need to provide the encrypted media information, including the mediaKey and the url where the encrypted file is hosted. The API will then decrypt the file and store it temporarily, returning a publicUrl from which the decrypted file can be downloaded. This public URL will be active for one hour.
Decrypt Media File
POST
/api/decrypt-media
This endpoint decrypts an encrypted media file (image, video, audio, document, or sticker). You provide the encrypted media information, and the API returns a temporary public URL to access the decrypted file. This URL is valid for one hour.
Request Body
The request body must be a JSON object containing the message data. The structure is as follows:
{ "data": { "messages": { "key": { "id": "YOUR_UNIQUE_MESSAGE_ID" }, "message": { "imageMessage": { "url": "URL_OF_ENCRYPTED_IMAGE", "mimetype": "image/jpeg", "mediaKey": "YOUR_MEDIA_KEY", "fileSha256": "FILE_SHA256_HASH", "fileLength": "FILE_SIZE_IN_BYTES", "fileName": "example.jpg" } } } } }
Note: The message
object can contain imageMessage
, videoMessage
, audioMessage
, documentMessage
, or stickerMessage
.
Parameters
Name | Type | Required | Description |
---|---|---|---|
data | object | Yes | Note: The message object must contain imageMessage, videoMessage, audioMessage, documentMessage, or stickerMessage, depending on the type of media you are decrypting. |
Code Examples
curl -X POST "https://www.wasenderapi.com/api/decrypt-media" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": {
"messages": {
"key": {
"id": "YOUR_UNIQUE_MESSAGE_ID"
},
"message": {
"imageMessage": {
"url": "URL_OF_ENCRYPTED_IMAGE",
"mimetype": "image/jpeg",
"mediaKey": "YOUR_MEDIA_KEY"
}
}
}
}
}'
Response Examples
{
"publicUrl": "https://www.wasenderapi.com/api/decrypted-media/YOUR_UNIQUE_MESSAGE_ID"
}