Developer Documentation

Riffre API Reference

Everything you need to send WhatsApp text, template, media and interactive messages from your own systems.

Send Media Messages

Send image, video, audio and document messages by public link or by uploaded media ID.

Last updated 05 Aug 2026

Image, video, audio and document messages all share the same request shape. Set type to the media kind you are sending, then provide a matching object under that same key.

Endpoint

POST /messages.php

Request body

FieldTypeRequiredApplies toDescription
tostringyesallRecipient's phone number, same format as Send a Text Message.
typestringyesallOne of image, video, audio, document.
<type>.idstringone of id/linkallA media ID previously returned by Upload Media.
<type>.linkstringone of id/linkallA public HTTPS URL Meta can fetch the file from.
<type>.captionstringnoimage, video, document0-1024 characters. Not supported for audio.
<type>.filenamestringnodocument only1-240 characters, shown to the recipient as the file name.

You must provide exactly one of id or link - never both, never neither. If you use link, it must resolve to a real https:// URL; Meta fetches the file directly from that URL when the message is sent.

curl -X POST "https://riffrechat.com/api/v1/messages.php" \
  -H "Authorization: Bearer rf_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "919876543210",
    "type": "image",
    "image": {
      "link": "https://example.com/images/product.jpg",
      "caption": "Our best seller"
    }
  }'

Example: document by uploaded media ID

{
  "to": "919876543210",
  "type": "document",
  "document": {
    "id": "1234567890",
    "caption": "Your invoice for order #1042",
    "filename": "invoice-1042.pdf"
  }
}
{
  "to": "919876543210",
  "type": "video",
  "video": { "link": "https://example.com/videos/demo.mp4", "caption": "How it works" }
}

Audio messages do not support a caption:

{
  "to": "919876543210",
  "type": "audio",
  "audio": { "link": "https://example.com/audio/note.ogg" }
}

Success response

Same shape as Send a Text Message: 202 Accepted with queue_id, status, status_label, charged, currency, balance_after, message_id and internal_queue_id.

Errors specific to media messages

error slug (varies by type)Cause
image_must_contain_exactly_one_of_id_or_linkNeither, or both, of id/link were supplied. Slug name changes per type, for example document_must_contain_exactly_one_of_id_or_link.
image_link_must_be_a_valid_https_urllink is not a valid https:// URL.
media_caption_must_contain_between_0_and_1024_characterscaption exceeds 1024 characters.
document_filename_must_contain_between_1_and_240_charactersfilename is empty or exceeds 240 characters.

To send a local file instead of a public link, upload it first with Upload Media and pass the returned id here.