Location

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": "location",
  "longitude": "72.877655",
  "latitude": "19.075983",
  "name": "Gupshup",
  "address": "101, Silver Metropolis, Bimbisar Nagar Rd, Bimbisar Nagar, Goregaon, Mumbai, Maharashtra 400063"
}' \
--data-urlencode 'src.name={{APP_NAME}}'

Sample Request

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'accept: application/json' \
--header 'apikey: xvnwgh9vgbbl6gjeezymu5v5iepxq2zt' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'source=918097424541' \
--data-urlencode 'destination=91735824xxxx' \
--data-urlencode 'src.name=TedLasso' \
--data-urlencode 'message={
  "type": "location",
  "longitude": "72.877655",
  "latitude": "19.075983",
  "name": "Gupshup",
  "address": "101, Silver Metropolis, Bimbisar Nagar Rd, Bimbisar Nagar, Goregaon, Mumbai, Maharashtra 400063"
}'

Request Parameters

ParameterLocationTypeDescriptionExample
apikeyHeaderstringAPIKEY of your Gupshup Account61b3021c97214370b341f8baaae0xxxx

Form Parameters (Request Body)

ParameterTypeRequiredDescriptionExample
sourceintegerYesSource Phone Number918929874278
destinationintegerYesDestination Phone Number918805162043
src.namestringYesApp Nameaugust18
messageobjectYesMessage object containing location detailsSee below for detailed structure

message object structure:

FieldTypeRequiredDefault ValueDescription
typestringYeslocationType of session message (fixed value)
longitudestringNo72.877655Longitude of the location in decimals
latitudestringNo19.075983Latitude of the location in decimals
namestringNoGupshupName of the location
addressstringNo101, Silver Metropolis, Bimbisar Nagar Rd, Bimbisar Nagar, Goregaon, Mumbai, Maharashtra 400063Caption for the message

Status Codes

Status CodeDescriptionResponse Body (application/json)
200Successful response{ "status": "submitted", "messageId": "183dc8f1-7ecc-4419-895f-04fd0b1bfe07" }
400Bad RequestEither:
{ "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!