Skip to Content
MailerSend
SMS API

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-recipients

Request parameters

Query parameterTypeRequiredLimitationsDetails
statusstringnoactive, opt_out
sms_number_idstringno
pageintno
limitintnoMin: 10, Max: 100Default: 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);

More examples

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 Entity

See - 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 parameterTypeRequiredLimitationsDetails
sms_recipient_idstringyes
use MailerSend\MailerSend;

$mailersend = new MailerSend(['api_key' => 'key']);

$smsRecipients = $mailersend->smsRecipient->find('sms_recipient_id');

More examples

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 Found

Update 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 parameterTypeRequiredLimitationsDetails
sms_recipient_idstringyes
Query parameterTypeRequiredLimitationsDetails
statusstringyesactive, opt_out
use MailerSend\MailerSend;

$mailersend = new MailerSend(['api_key' => 'key']);

$smsRecipients = $mailersend->smsRecipient->update('sms_recipient_id', $status = 'opt_out');

More examples

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 Entity

See - Validations errors

On this page