post https://api.gupshup.io/wa/api/v1/msg
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 Name | Location | Type | Description | Required | Example |
|---|---|---|---|---|---|
| apikey | Header | string | APIKEY of your Gupshup Account | Yes | 61b3021c97214370b341f8baaae0xxxx |
Form Parameters
| Parameter Name | Location | Type | Description | Required | Example |
|---|---|---|---|---|---|
| source | Form | integer | Source Phone Number | Yes | 918929874278 |
| destination | Form | integer | Destination Phone Number | Yes | 918805162043 |
| src.name | Form | string | App Name | Yes | august18 |
| message | Form | object | Message object (refer to schema) | Yes | Refer to Message schema below |
Message Object (Form Parameter)
| Property Name | Type | Description | Required | Example |
|---|---|---|---|---|
| context | object | Message context | No | { "msgId": "uniqueMsgId" } |
| type | string | Type of session message | Yes | image |
| id | string | Media Id of the Image | No | abc123 |
| caption | string | Message caption | No | Lorem Ipsum |
| originalUrl | string | URL of the image | No | https://picsum.photos/200 |
| previewUrl | string | Preview URL of the image | No | https://picsum.photos/200 |
Response Parameters
| Parameter Name | Type | Description | Example |
|---|---|---|---|
| status | string | Response status | submitted |
| messageId | string | Unique message ID | 183dc8f1-7ecc-4419-895f-04fd0b1bfe07 |
| message | string | Error message | Invalid Destination, Invalid App Details, Authentication Failed, Too Many Requests |
| status | string | Status of the request | error |
Status Codes
Status Code | Description | Response Schema |
|---|---|---|
200 | Successful response | { "status": "submitted", "messageId": "183dc8f1-7ecc-4419-895f-04fd0b1bfe07" } |
400 | Bad Request | { "message": "Invalid Destination", "status": "error" } |
401 | Authentication Failed | { "message": "Authentication Failed", "status": "error" } |
429 | Too Many Requests | { "message": "Too Many Requests", "status": "error" } |
