Image

cURL

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: {{APIKEY}}' \
--data-urlencode 'source={{SOURCE}}' \
--data-urlencode 'destination={{DESTINATION}}' \
--data-urlencode 'message={
  "type": "image",
  "caption": "Lorem Ipsum",
  "originalUrl": "https://picsum.photos/200",
  "previewUrl": "https://picsum.photos/200"
}' \
--data-urlencode 'src.name={{APP_NAME}}'

Sample Request

With Media Id, Without Context

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'accept: application/json' \
--header 'apikey: fgp6azc5oe5jk1iw9nlwmdymofqqnktd' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'source=918929874278' \
--data-urlencode 'destination=918805162043' \
--data-urlencode 'src.name=august18' \
--data-urlencode 'message={"type":"image","caption":"Lorem Ipsum","id":"77362728271623327"}

With URL, Without Context

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'accept: application/json' \
--header 'apikey: fgp6azc5oe5jk1iw9nlwmdymofqqnktd' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'source=918929874278' \
--data-urlencode 'destination=918805162043' \
--data-urlencode 'src.name=august18' \
--data-urlencode 'message={"type":"image","caption":"Lorem Ipsum","originalUrl":"https://picsum.photos/200","previewUrl":"https://picsum.photos/200"}'

Request Parameters

Header Parameters

Parameter NameLocationTypeDescriptionRequiredExample
apikeyHeaderstringAPIKEY of your Gupshup AccountYes61b3021c97214370b341f8baaae0xxxx

Form Parameters

Parameter NameLocationTypeDescriptionRequiredExample
sourceFormintegerSource Phone NumberYes918929874278
destinationFormintegerDestination Phone NumberYes918805162043
src.nameFormstringApp NameYesaugust18
messageFormobjectMessage object (refer to schema)YesRefer to Message schema below

Message Object (Form Parameter)

Property NameTypeDescriptionRequiredExample
contextobjectMessage contextNo{ "msgId": "uniqueMsgId" }
typestringType of session messageYesimage
idstringMedia Id of the ImageNoabc123
captionstringMessage captionNoLorem Ipsum
originalUrlstringURL of the imageNohttps://picsum.photos/200
previewUrlstringPreview URL of the imageNohttps://picsum.photos/200

Response Parameters

Parameter NameTypeDescriptionExample
statusstringResponse statussubmitted
messageIdstringUnique message ID183dc8f1-7ecc-4419-895f-04fd0b1bfe07
messagestringError messageInvalid Destination, Invalid App Details, Authentication Failed, Too Many Requests
statusstringStatus of the requesterror

Status Codes

Status CodeDescriptionResponse Schema
200Successful response{ "status": "submitted", "messageId": "183dc8f1-7ecc-4419-895f-04fd0b1bfe07" }
400Bad Request{ "message": "Invalid Destination", "status": "error" }
or
{ "message": "Invalid App Details", "status": "error" }
401Authentication Failed{ "message": "Authentication Failed", "status": "error" }
429Too Many Requests{ "message": "Too Many Requests", "status": "error" }
Language
Click Try It! to start a request and see the response here!