Uploads a media file (image, video, or document) to Meta’s storage and returns a header_handle.
Endpoint
POST /api/integrations/uploadTemplateMedia
Base URL
https://api.rampwin.com
Description
Uploads media to Meta and generates a header_handle, which is required when creating WhatsApp templates with media headers.
When to Use
Use this API only when your template includes a media header, such as:
- IMAGE
- VIDEO
- DOCUMENT
Authentication
This API supports:
- API Key
Headers
| Header | Type | Required | Description |
|---|---|---|---|
| x-api-key | string | Yes | Your Rampwin API key |
| accept | string | Yes | application/json, text/plain, / |
| Content-Type | string | Yes | multipart/form-data |
| Cookie | string | Yes | AWS load balancer session cookie |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| channel_id | string | Yes | WhatsApp channel ID |
Form Data
| Field | Type | Required | Description |
|---|---|---|---|
| common_file | file | Yes | File to upload |
Supported Media Types
| Type | Formats | Max Size |
|---|---|---|
| Image | JPG, PNG | 5 MB |
| Video | MP4 | 16 MB |
Example Request
curl --location 'https://api.rampwin.com/api/integrations/uploadTemplateMedia?channel_id=YOUR_CHANNEL_ID' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'accept: application/json, text/plain, */*' \
--form 'common_file=@"/path/to/file.jpg"'
Response
Success (200)
{
"success": true,
"header_handle": "4::aW1hZ2UvanBlZw==:ARa..."
}
Error (400)
{
"success": false,
"message": "Invalid file type"
}
Common Errors
| Error | Description |
|---|---|
| Invalid file type | Unsupported format |
| File size exceeded | File too large |
| Missing channel_id | Query parameter missing |
| Missing file | No file uploaded |
| Unauthorized | Invalid API key |
