Upload Template Media
Overview
Before creating a template with an Image, Document, or Video header, you must first upload the media file using this endpoint.
It uploads the file to both AWS S3 and Meta’s media upload session, and returns:
h— the Meta media handle (used inheader_handlewhen creating the template)s3Url— the S3 URL (used as the top-levels3Urlfield when creating the template)
Endpoint
POST https://client-api.wappcloud.com/api/v1/external/templates/upload/mediaHeaders
| Header | Description |
|---|---|
x-api-key | (Required) Your API Key for authentication |
Authorization | (Required) Bearer Token |
Content-Type | multipart/form-data |
Request Body (form-data)
| Key | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The media file to upload (image, document, video) |
Supported File Types
| Template Header Type | Accepted Formats |
|---|---|
IMAGE | .jpg, .jpeg, .png |
DOCUMENT | .pdf |
VIDEO | .mp4 |
Setting Up in Postman
- Select the Body tab
- Choose form-data
- Add a key named
file, set the type to File, and select your file
Response (Success)
{
"success": true,
"code": 200,
"message": "Template listed created",
"data": {
"h": "4:abcDEF1234567890exampleMetaHandle...",
"s3Url": "https://your-bucket.s3.amazonaws.com/12345678/templates/550e8400-e29b-uuid.jpg"
}
}| Field | Description |
|---|---|
h | Meta media handle — use this as the value inside header_handle array in Create Template |
s3Url | S3 URL — pass this as the top-level s3Url field in the Create Template request body |
How to Use the Response
Copy both values from the response and use them when calling Create Template:
{
"name": "my_image_template",
"category": "MARKETING",
"language": "en_US",
"s3Url": "<s3Url from upload response>",
"components": [
{
"type": "HEADER",
"format": "IMAGE",
"example": {
"header_handle": ["<h from upload response>"]
}
},
{
"type": "BODY",
"text": "Check out our latest collection!"
}
]
}Error Responses
400 Bad Request — No file uploaded
{
"success": false,
"code": 400,
"message": "No file uploaded"
}400 Bad Request — Invalid file size
{
"success": false,
"code": 400,
"message": "File size exceeds the allowed limit"
}401 Unauthorized
{
"error": "Missing authToken or x-api-key"
}Notes
- Upload the media file before calling Create Template.
- The
hhandle from Meta expires — create the template promptly after uploading. - Only one file per request. To use different media for different templates, upload separately each time.