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 type | Allowed formats | Max size |
|---|---|---|
| Image | JPEG, PNG | 5 MB |
| Video | MP4, 3GPP | 16 MB |
| Audio | AAC, AMR, MP3/MPEG, MP4 audio, OGG | 16 MB |
| Document | Plain 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 slug | HTTP status | Cause |
|---|---|---|
a_valid_bearer_api_key_is_required | 401 | Missing or malformed Authorization header. |
api_key_is_invalid_disabled_or_expired | 401 | Key not found, disabled, expired, or its phone number is inactive. |
this_media_format_is_not_supported | 422 | The file's sniffed MIME type is not in the supported list above. |
too_many_attempts | 429 | Rate limit exceeded - see Rate Limits. |
media_not_uploaded | 500 | Unexpected upload failure. |