Recipients
Easily manage SMS recipients with the MailerSend API. Retrieve a list of recipients and their information, and update their status.
Get information about SMS recipients.
Get a list of SMS recipients
Get a list of SMS recipients information with this GET request:
GET https://api.mailersend.com/v1/sms-recipientsRequest parameters
| Query parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
status | string | no | active, opt_out | |
sms_number_id | string | no | ||
page | int | no | ||
limit | int | no | Min: 10, Max: 100 | Default: 25 |
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\SmsRecipientParams;
$mailersend = new MailerSend(['api_key' => 'key']);
$smsRecipientParams = (new SmsRecipientParams())
->setSmsNumberId('sms_number_id')
->setStatus('opt_out')
->setPage(3)
->setLimit(15);
$smsRecipients = $mailersend->smsRecipient->getAll($smsRecipientParams);Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"data": [
{
"id": "62347d2be979fd275c0afd34",
"number": "+1234567890",
"status": "active",
"opted_out_at": null,
"opt_out_source": null,
"created_at": "2022-01-01T12:00:03.000000Z"
}
],
"links": {
"first": "https://api.mailersend.com/v1/sms-recipients?page=1",
"last": null,
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"current_page_url": "https://api.mailersend.com/v1/sms-recipients?page=1",
"from": 1,
"path": "https://api.mailersend.com/v1/sms-recipients",
"per_page": 25,
"to": 1
}
}Error
Response Code: 422 Unprocessable EntitySee - Validations errors
Get an SMS recipient
Get information about a specific SMS recipient with this GET request:
GET https://api.mailersend.com/v1/sms-recipients/{sms_recipient_id}Request parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
sms_recipient_id | string | yes |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$smsRecipients = $mailersend->smsRecipient->find('sms_recipient_id');Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"data": {
"id": "62347d2be979fd275c0afd34",
"number": "+1234567890",
"status": "active",
"opted_out_at": null,
"opt_out_source": null,
"created_at": "2022-01-01T12:00:00.000000Z",
"sms_number": {
"telephone_number": "+1234567890"
},
"sms": [
{
"id": "62347d2be979fd275c0afd33",
"from": "+1234567890",
"to": "+1234567890",
"text": "Lorem Ipsum is simply dummy text",
"compiled_text": "Lorem Ipsum is simply dummy text",
"status": "delivered",
"segment_count": 1,
"error_type": null,
"error_code": null,
"error_description": null,
"created_at": "2022-01-01T12:00:00.000000Z"
}
]
}
}Error
Response Code: 404 Not FoundUpdate a single SMS recipient
Update a specific SMS recipient with this PUT request:
PUT https://api.mailersend.com/v1/sms-recipients/{sms_recipient_id}Request parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
sms_recipient_id | string | yes |
| Query parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
status | string | yes | active, opt_out |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$smsRecipients = $mailersend->smsRecipient->update('sms_recipient_id', $status = 'opt_out');Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"data": {
"id": "62347d2be979fd275c0afd34",
"number": "+1234567890",
"status": "opt_out",
"opted_out_at": "2022-01-01T12:05:00.000000Z",
"opt_out_source": "api",
"created_at": "2022-01-01T12:00:03.000000Z"
}
}Error
Response Code: 422 Unprocessable EntitySee - Validations errors
Activity
Track your messages with the SMS Activity API endpoint. Get a list of activities or view the activity of a single message. Upgrade your communication strategy with MailerSend.
Webhooks
View available webhook events and create, manage and update webhooks with the SMS Webhooks API endpoint. Receive important notifications and optimize workflows.