Upload media
Last update: 6 hours ago by Irais Aguirre
Integration summary
- Base URL:
https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services- Token: admin token, in the
Authorization: Bearer {{admin-token}}header (how to generate it)- Endpoints on this page:
POST /v1/template/{{waba_id}}/media-upload: Upload header media
Upload header media
Uploads an image, video, or document to Meta from a public URL and returns its ID. Use this ID in the header_handle field when you create a template with a media header.
Request
Upload header media request:
| URL | https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/template/{{waba_id}}/media-upload |
| Method | POST |
| Type | application/json |
Headers
Upload header media headers:
| Name | Description | Type | Requirements |
|---|---|---|---|
| Content-Type | application/json | String | Required |
| Authorization | Admin token. See Generate authentication token. | String | Required |
Parameters
Upload header media parameters:
| Name | Description | Type | Requirements |
|---|---|---|---|
| waba_id | WhatsApp Business Account (WABA) ID. It must be the WABA linked to your token. | String | Required |
Body
Upload header media body fields:
| Name | Description | Type | Requirements |
|---|---|---|---|
| url | Public URL of the media file. Supported file types: PDF, JPEG, JPG, PNG, and MP4. Maximum file size: 10 MB. | String | Required |
Example
Complete Upload header media example:
curl -X POST "https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/template/{{waba_id}}/media-upload" \-H 'Content-Type: application/json' \-H 'Authorization: Bearer {{admin-token}}' \-d '{"url": "https://iili.io/HDQOyc7.jpg"}'
Response
Upload header media response:
If the file is uploaded successfully, the service responds with HTTP status code 201.
| Name | Description | Type |
|---|---|---|
| url | URL of the media file you sent. | String |
| id | Media ID. Use it in the header_handle field when you create the template. | String |
{"url": "https://iili.io/HDQOyc7.jpg","id": "4::aW1hZ2UvanBlZw==:ARZExampleHandle:e:1771350704:1234567890:1234567890:ARZExample"}
