Skip to content

Download media ​

Downloads the file behind a message's media.url. The response is the file itself (image, audio, video or document) with its Content-Type, not JSON.

Take a message's media.url from List messages and pass it, unchanged, as path (URL-encoded). The host part of the URL is ignored. Only files of this channel can be downloaded.

GET/api/user/whatsapp-qr/channels/{channel}/media
Required scope: whatsapp-qr:read
Path parameters
integer
Query parameters
string
curl -X GET "https://loopx-console.test/api/user/whatsapp-qr/channels/105/media?path=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fs3%2Fgenudo-whatsapp-media%2Fdevelopment-whatsapp-105%2F3AEF0449C153977B1897.oga" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"
<?php

use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('GET', 'https://loopx-console.test/api/user/whatsapp-qr/channels/105/media?path=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fs3%2Fgenudo-whatsapp-media%2Fdevelopment-whatsapp-105%2F3AEF0449C153977B1897.oga', [
    'headers' => [
        'Authorization' => 'Bearer $TOKEN',
        'Accept'        => 'application/json',
    ]
]);

$data = json_decode($response->getBody(), true);
const res = await fetch('https://loopx-console.test/api/user/whatsapp-qr/channels/105/media?path=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fs3%2Fgenudo-whatsapp-media%2Fdevelopment-whatsapp-105%2F3AEF0449C153977B1897.oga', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer $TOKEN',
    Accept: 'application/json'
  }
});

const data = await res.json();

Example ​

bash
curl -G -o voice.oga "https://api.genudo.ai/api/user/whatsapp-qr/channels/105/media" \
  --data-urlencode "path=http://localhost:3000/api/s3/genudo-whatsapp-media/development-whatsapp-105/3AEF0449C153977B1897.oga" \
  -H "Authorization: Bearer $TOKEN"

Browsers don't send your token in <img src> or <audio src>. To show media on a web page, download it on your server, or fetch it with your token and use a blob URL.

Errors ​

CodeMeaning
404The file doesn't exist, or doesn't belong to this channel
502The WhatsApp server couldn't be reached