Developer Documentation

Riffre API Reference

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

Upload Media

Upload a file to get a reusable media ID for image, video, audio and document messages.

Last updated 05 Aug 2026

Upload a file once and reuse the returned media ID across multiple media messages, instead of sending a public link every time.

Endpoint

POST /media.php

Requires the same Authorization: Bearer header as every other endpoint. Uses multipart/form-data, not JSON.

Request

Send the file as a multipart field named file:

curl -X POST "https://riffrechat.com/api/v1/media.php" \
  -H "Authorization: Bearer rf_live_YOUR_API_KEY" \
  -F "file=@product.jpg"

The file's actual content is sniffed server-side to determine its MIME type - the filename extension and any client-supplied Content-Type are not trusted.

Supported file types and size limits

Media typeAllowed formatsMax size
ImageJPEG, PNG5 MB
VideoMP4, 3GPP16 MB
AudioAAC, AMR, MP3/MPEG, MP4 audio, OGG16 MB
DocumentPlain text, PDF, Word (.doc/.docx), Excel (.xls/.xlsx), PowerPoint (.ppt/.pptx)100 MB

A file whose sniffed MIME type is not in this list, or that exceeds its type's size limit, is rejected with 422.

Success response

201 Created:

{
  "id": "1234567890",
  "library_id": "6a2f9c9e-2e1a-4b7d-9d3d-0a5b7c8d9e0f",
  "type": "image",
  "mime_type": "image/png",
  "filename": "product.png",
  "file_size": 48213
}

Use the id field as image.id / video.id / audio.id / document.id in a subsequent call to Send Media Messages. library_id is Riffre's own internal reference for the upload and is not used in send-message requests.

Errors

error slugHTTP statusCause
a_valid_bearer_api_key_is_required401Missing or malformed Authorization header.
api_key_is_invalid_disabled_or_expired401Key not found, disabled, expired, or its phone number is inactive.
this_media_format_is_not_supported422The file's sniffed MIME type is not in the supported list above.
too_many_attempts429Rate limit exceeded - see Rate Limits.
media_not_uploaded500Unexpected upload failure.
Uploaded media is scoped to the same WhatsApp phone number as the API key used to upload it, and can only be referenced by messages sent from that same number.