Inbound routing
Learn how to efficiently create and manage SMS inbound routes with MailerSend's API documentation and the SMS inbounds endpoint.
Get a list of SMS inbound routes
If you want to retrieve information about multiple SMS inbound routes, use this GET request:
GET https://api.mailersend.com/v1/sms-inboundsRequest parameters
| Query parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
sms_number_id | string | no | ||
enabled | boolean | no | ||
page | int | no | ||
limit | int | no | Min: 10, Max: 100 | Default: 15 |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$smsRecipients = $mailersend->smsInbound->getAll($smsNumberId = 'sms_number_id', $enabled = true, $page = 3, $limit = 15);Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"data": [
{
"id": "7z3m5jgrogdpyo6n",
"name": "Inbound",
"filter": {
"value": "START",
"comparer": "equal"
},
"forward_url": "https://yourapp.com/hook",
"enabled": true,
"secret": "jYhafGtTiZgw0qWxlkUA7cbqTG3Zfh2j",
"created_at": "2022-01-01T12:00:00.000000Z"
}
],
"links": {
"first": "https://api.mailersend.com/v1/sms-inbounds?page=1",
"last": "https://api.mailersend.com/v1/sms-inbounds?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "https://api.mailersend.com/v1/sms-inbounds",
"per_page": 15,
"to": 1,
"total": 1
}
}Error
Response Code: 422 Unprocessable EntitySee - Validation errors
Get a single SMS inbound route
If you want to retrieve a single SMS inbound route, use this GET request:
GET https://api.mailersend.com/v1/sms-inbounds/{sms_inbound_id}Request parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
sms_inbound_id | string | yes |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$smsRecipients = $mailersend->smsInbound->find('sms_inbound_id');Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"data": {
"id": "7z3m5jgrogdpyo6n",
"name": "Inbound",
"filter": {
"value": "START",
"comparer": "equal"
},
"forward_url": "https://yourapp.com/hook",
"enabled": true,
"secret": "jYhafGtTiZgw0qWxlkUA7cbqTG3Zfh2j",
"created_at": "2022-01-13T12:00:00.000000Z",
"sms_number": {
"id": "7z3m5jgrogdpyo6n",
"telephone_number": "+19199876543",
"paused": false,
"created_at": "2022-01-13T12:00:00.000000Z"
}
}
}Error
Response Code: 404 Not FoundAdd an SMS inbound route
If you want to add a new SMS inbound route to a domain, use this POST request:
POST https://api.mailersend.com/v1/sms-inboundsRequest body
{
"sms_number_id": "7z3m5jgrogdpyo6n",
"name": "Inbound",
"forward_url": "https://yourapp.com/hook",
"filter": {
"comparer": "equal",
"value": "START"
},
"enabled": true
}Request Parameters
JSON parameters are provided in dot notation
| JSON Parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
sms_number_id | string | Yes | ||
name | string | Yes | Max 191 characters. | |
forward_url | string | Yes | Must be a valid, publicly reachable URL. | MailerSend sends a test request to this URL. It must return a 2xx response within 3 seconds. |
filter | object | No | ||
filter.comparer | string | Yes* | Must be one of the comparers: equal, not-equal, contains, not-contains, starts-with, ends-with, not-starts-with, not-ends-with. | |
filter.value | string | Yes* | Min: 1, Max 255 characters. | |
enabled | boolean | No |
* Required when filter object is provided.
Responses
| Response Key | Type | Details |
|---|---|---|
| data | object | SMS Inbound object created. |
Valid
Response Code: 201 CREATED
Response Headers:
content-type: application/json{
"data": {
"id": "7z3m5jgrogdpyo6n",
"name": "Inbound",
"filter": {
"value": "START",
"comparer": "equal"
},
"forward_url": "https://yourapp.com/hook",
"enabled": true,
"secret": "jYhafGtTiZgw0qWxlkUA7cbqTG3Zfh2j",
"created_at": "2022-01-01T12:00:00.000000Z"
}
}Invalid
Response Code: 422 Unprocessable EntitySee - Validation errors
Update an inbound route
If you want to update the information of an existing inbound route, use this PUT request:
PUT https://api.mailersend.com/v1/sms-inbounds/{sms_inbound_id}Request body
{
"sms_number_id": "7z3m5jgrogdpyo6n",
"name": "Inbound",
"forward_url": "https://yourapp.com/hook",
"filter": {
"comparer": "equal",
"value": "START"
},
"enabled": true
}Request Parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
sms_inbound_id | string | yes |
JSON parameters are provided in dot notation
| JSON Parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
sms_number_id | string | No | ||
name | string | No | Max 191 characters. | |
forward_url | string | No | Must be a valid, publicly reachable URL. | MailerSend sends a test request to this URL. It must return a 2xx response within 3 seconds. |
filter | object | No | ||
filter.comparer | string | Yes* | Must be one of the comparers: equal, not-equal, contains, not-contains, starts-with, ends-with, not-starts-with, not-ends-with. | |
filter.value | string | Yes* | Min: 1, Max 255 characters. | |
enabled | boolean | No |
* Required when filter object is provided.
Responses
| Response Key | Type | Details |
|---|---|---|
| data | object | SMS Inbound object created. |
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"data": {
"id": "7z3m5jgrogdpyo6n",
"name": "Inbound",
"filter": {
"value": "START",
"comparer": "equal"
},
"forward_url": "https://yourapp.com/hook",
"enabled": true,
"secret": "jYhafGtTiZgw0qWxlkUA7cbqTG3Zfh2j",
"created_at": "2022-01-01T12:00:00.000000Z"
}
}Invalid
Response Code: 422 Unprocessable EntitySee - Validation errors
Delete an SMS inbound route
If you want to delete an SMS inbound route, use this DELETE request:
DELETE https://api.mailersend.com/v1/sms-inbounds/{sms_inbound_id}Request parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
sms_inbound_id | string | yes |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$smsRecipients = $mailersend->smsInbound->delete('sms_inbound_id');Responses
Valid
Response Code: 204 No Content
Response Body: [EMPTY]Error
Response Code: 404 Not FoundWebhooks
View available webhook events and create, manage and update webhooks with the SMS Webhooks API endpoint. Receive important notifications and optimize workflows.
Sending a WhatsApp message
Send template-based WhatsApp messages with the MailerSend WhatsApp API. Learn about senders, recipients, personalization and delivery tracking.