post
https://partner.gupshup.io/partner/app//media
Use this API to generate the media ID using URL.
AttentionThis guide is no longer maintained from 31st Jan 2025. Please refer the updated one here.
Request Parameters
| Key | Description | Values | Data Type | Required/Optional | Constraints |
|---|---|---|---|---|---|
| Authorization | Access Token for the application | {{PARTNER_APP_TOKEN}} | String | Required | Should be a valid Partner App Access Token. |
| appId | App ID to fetch the access token | {{App_ID}} | String | Required | The ID should be a valid app ID of Gupshup |
| file_type | File type to generate media ID | image/png | String | Required | aram file must be a file with one of the following types: |
| file | File URL to generate media id | https://image.png | String | Required | Should be a valid file URL. |
Sample Request
curl --request POST \
--url https://partner.gupshup.io/partner/app/{{APP_ID}}/media \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--header 'token: {{PARTNER_APP_TOKEN}}' \
--form file=https://image.jpeg \
--form file_type=image/jpegSample Response
{
"mediaId": "1852559851913765",
"status": "success"
}Status Codes
| Status Code | Response | Comments |
|---|---|---|
| Success | ||
| 200 | { "mediaId": "1852559851913765", "status": "success" } | |
| Error | ||
| 400 | { "message": "Only CAPI apps allowed to generate media ID", "status": "error" } | Bad Request when app is non CAPI |
| 413 | { "message": "File size exceeds the maximum limit!", "status": "error" } | Supported 100 MB file size |
| 500 | { "message": "Unable to upload requested Media", "status": "error" } | Internal Error occurred. Try after some time. If the issue persists contact the support team |
