Generate Media ID Using URL

Use this API to generate the media ID using URL.

Request Parameters

KeyDescriptionValuesData TypeRequired/OptionalConstraints
AuthorizationAccess Token for the application{{PARTNER_TOKEN}}StringRequiredShould be a valid Partner App Access Token.
APP IDApp ID to fetch the access tokenbf9ee64c-3d4d-4ac4-xxxx-732e577007c4StringRequiredThe ID should be a valid app ID of Gupshup
file_typeFile type to generate media IDimage/pngStringRequiredaram file must be a file with one of the following types:
audio/aac, audio/mp4, audio/mpeg, audio/amr, audio/ogg, audio/opus, application/vnd.ms-powerpoint, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/pdf, text/plain, application/vnd.ms-excel, image/jpeg, image/png, image/webp, video/mp4, video/3gpp. Received file of type ''."
fileFile URL to genetate media idhttps://image.pngStringRequired Should be a valid file URL.

File size should not be more than 100 MB

Sample Request

curl --request POST \
     --url https://partner.gupshup.io/partner/app/07c7c72d-20e3-4ff9-a5a1-14d1186eeec8/media \
     --header 'accept: application/json' \
     --header 'content-type: multipart/form-data' \
     --header 'token: sk_8eb35b1f81c24af293a405164a392f30' \
     --form file=https://image.jpeg \
     --form file_type=image/jpeg

Sample Response

{
  "mediaId": "1852559851913765",
  "status": "success"
}

Status Codes

Status CodeResponseComments
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
Language
Click Try It! to start a request and see the response here!