Upload Template Media

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

HeaderTypeRequiredDescription
x-api-keystringYesYour Rampwin API key
acceptstringYesapplication/json, text/plain, /
Content-TypestringYesmultipart/form-data
CookiestringYesAWS load balancer session cookie

Query Parameters

ParameterTypeRequiredDescription
channel_idstringYesWhatsApp channel ID

Form Data

FieldTypeRequiredDescription
common_filefileYesFile to upload

Supported Media Types

TypeFormatsMax Size
ImageJPG, PNG5 MB
VideoMP416 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

ErrorDescription
Invalid file typeUnsupported format
File size exceededFile too large
Missing channel_idQuery parameter missing
Missing fileNo file uploaded
UnauthorizedInvalid API key