Skip to Content
MailerSend
Email API

Sender Identities

Easily manage email sender identities with MailerSend's API. Add, update, delete and retrieve a list of sender identities.

Get a list of sender identities

Retrieve information about sender identities with this GET request:

GET https://api.mailersend.com/v1/identities

Request parameters

Query parameterTypeRequiredLimitationsDetails
domain_idstringno
pageintnoMin: 1
limitintnoMin: 10, Max: 100Default: 25
querystringnoFilter by email address.
order_bystringnoemail, created_at, verified_atDefault: created_at
orderstringnoasc, descDefault: asc
use MailerSend\MailerSend;

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

$mailersend->senderIdentity->getAll($domainId = 'domainId', $page = 1, $limit = 10);

More examples

Responses

Valid

Response Code: 200 OK
Response Headers:
	content-type: application/json
{
  "data": [
    {
      "id": "7nxe3yjmeq28vp0k",
      "email": "john@test.com",
      "name": "John Doe",
      "reply_to_email": null,
      "reply_to_name": null,
      "is_verified": false,
      "resends": 0,
      "add_note": false,
      "personal_note": null,
      "domain": {
        "id": "7nxe3yjmeq28vp0k",
        "name": "test.com",
        "created_at": "2022-11-29T10:43:22.000000Z",
        "updated_at": "2022-11-29T10:43:32.000000Z"
      }
    }
  ],
  "links": {
    "first": "https://api.mailersend.com/v1/identities?page=1",
    "last": "https://api.mailersend.com/v1/identities?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "« Previous",
        "page": null,
        "active": false
      },
      {
        "url": "https://api.mailersend.com/v1/identities?page=1",
        "label": "1",
        "page": 1,
        "active": true
      },
      {
        "url": null,
        "label": "Next »",
        "page": null,
        "active": false
      }
    ],
    "path": "https://api.mailersend.com/v1/identities",
    "per_page": 25,
    "to": 1,
    "total": 1
  }
}

Error

Response Code: 422 Unprocessable Entity

See - Validation errors

Get a single sender identity

If you want to retrieve a single sender identity, use this GET request:

GET https://api.mailersend.com/v1/identities/{identity_id}

Request parameters

URL parameterTypeRequiredLimitationsDetails
identity_idstringyes
use MailerSend\MailerSend;

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

$mailersend->senderIdentity->find('identityId');

More examples

Responses

Valid

Response Code: 200 OK
Response Headers:
	content-type: application/json
{
  "data": {
      "id": "7nxe3yjmeq28vp0k",
      "email": "john@test.com",
      "name": "John Doe",
      "reply_to_email": null,
      "reply_to_name": null,
      "is_verified": false,
      "resends": 0,
      "add_note": false,
      "personal_note": null,
      "domain": {
          "id": "7nxe3yjmeq28vp0k",
          "name": "test.com",
          "created_at": "2022-11-29T10:43:22.000000Z",
          "updated_at": "2022-11-29T10:43:32.000000Z"
      }
    }
}

Error

Response Code: 404 Not Found

Get a single sender identity by email

If you want to retrieve a single sender identity by email, use this GET request:

GET https://api.mailersend.com/v1/identities/email/{email}

Request parameters

URL parameterTypeRequiredLimitationsDetails
emailstringyes
use MailerSend\MailerSend;

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

$mailersend->senderIdentity->findByEmail('email');

More examples

Responses

Valid

Response Code: 200 OK
Response Headers:
	content-type: application/json
{
  "data": {
      "id": "7nxe3yjmeq28vp0k",
      "email": "john@test.com",
      "name": "John Doe",
      "reply_to_email": null,
      "reply_to_name": null,
      "is_verified": false,
      "resends": 0,
      "add_note": false,
      "personal_note": null,
      "domain": {
          "id": "7nxe3yjmeq28vp0k",
          "name": "test.com",
          "created_at": "2022-11-29T10:43:22.000000Z",
          "updated_at": "2022-11-29T10:43:32.000000Z"
      }
    }
}

Error

Response Code: 404 Not Found

Add a sender identity

If you want to add a new sender identity from which you can send emails without having to verify a domain, use this POST request:

POST https://api.mailersend.com/v1/identities

Request body

{
  "domain_id": "7nxe3yjmeq28vp0k",
  "email": "pedro@test.com",
  "name": "Pedro Doe",
  "personal_note": "Hi Pedro, please confirm this email by clicking on the link below.",
  "reply_to_name": "Test Doe",
  "reply_to_email": "test@test.com",
  "add_note": true
}

Request Parameters

JSON parameters are provided in dot notation

JSON ParameterTypeRequiredLimitationsDetails
domain_idstringyes
namestringnoMax 191 characters.
emailstringyesMax 320 characters, unique per domain. Domains marked as unavailable or with a DMARC p=reject policy are rejected.
reply_to_emailstringnoMax 320 characters. Domains marked as unavailable are rejected.Required when reply_to_name is set.
reply_to_namestringnoMax 191 characters.
add_notebooleanno
personal_notestringnoMax 250 characters. HTML is stripped. Can't contain links, domain names or email addresses.

Responses

Response KeyTypeDetails
dataobjectIdentity object created.

Valid

Response Code: 201 CREATED
Response Headers:
	content-type: application/json
{
    "data": {
        "id": "7nxe3yjmeq28vp0k",
        "email": "pedro@test.com",
        "name": "Pedro Doe",
        "reply_to_email": "test@test.com",
        "reply_to_name": "Test Doe",
        "is_verified": false,
        "resends": 0,
        "add_note": false,
        "personal_note": null,
        "domain": {
            "id": "7nxe3yjmeq28vp0k",
            "name": "test.com",
            "created_at": "2022-11-29T10:43:22.000000Z",
            "updated_at": "2022-11-29T10:43:32.000000Z"
        }
    }
}

Invalid

Response Code: 422 Unprocessable Entity

See - Validation errors

Identity limit error

Response Code: 403 Forbidden
Response Headers:
	content-type: application/json
{
  "message": "You've reached the maximum sender identity limit. Upgrade to add more identities."
}

Update a sender identity

If you want to update the information of an existing sender identity, use this PUT request:

PUT https://api.mailersend.com/v1/identities/{identity_id}

Request body

{
  "name": "Pedro Doe",
  "reply_to_name": "Test Doe",
  "reply_to_email": "test@test.com"
}

Request Parameters

URL parameterTypeRequiredLimitationsDetails
identity_idstringyes

JSON parameters are provided in dot notation

JSON ParameterTypeRequiredLimitationsDetails
namestringnoMax 191 characters.
reply_to_emailstringnoMax 320 characters. Domains marked as unavailable are rejected.Required when reply_to_name is set.
reply_to_namestringnoMax 191 characters.
add_notebooleannoWhether to add personal_note to the verification email.
personal_notestringnoMax 250 characters. HTML is stripped. Can't contain links, domain names or email addresses.

Responses

Response KeyTypeDetails
dataobjectIdentity object updated.

Valid

Response Code: 200 OK
Response Headers:
	content-type: application/json
{
  "data": {
      "id": "7nxe3yjmeq28vp0k",
      "email": "pedro@test.com",
      "name": "Pedro Doe",
      "reply_to_email": "test@test.com",
      "reply_to_name": "Test Doe",
      "is_verified": false,
      "resends": 0,
      "add_note": false,
      "personal_note": null,
      "domain": {
          "id": "7nxe3yjmeq28vp0k",
          "name": "test.com",
          "created_at": "2022-11-29T10:43:22.000000Z",
          "updated_at": "2022-11-29T10:43:32.000000Z"
      }
  }
}

Invalid

Response Code: 422 Unprocessable Entity

See - Validation errors

Premium feature error

Response Code: 403 Forbidden
Response Headers:
	content-type: application/json
{
  "message": "Sender identity is a premium feature. Please Upgrade your plan to update sender identity."
}

Error

Response Code: 404 Not Found

Update a sender identity by email

If you want to update the information of an existing sender identity by email, use this PUT request:

PUT https://api.mailersend.com/v1/identities/email/{email}

Request body

{
  "name": "Pedro Doe",
  "reply_to_name": "Test Doe",
  "reply_to_email": "test@test.com"
}

Request Parameters

URL parameterTypeRequiredLimitationsDetails
emailstringyes

JSON parameters are provided in dot notation

JSON ParameterTypeRequiredLimitationsDetails
namestringnoMax 191 characters.
reply_to_emailstringnoMax 320 characters. Domains marked as unavailable are rejected.Required when reply_to_name is set.
reply_to_namestringnoMax 191 characters.
add_notebooleannoWhether to add personal_note to the verification email.
personal_notestringnoMax 250 characters. HTML is stripped. Can't contain links, domain names or email addresses.

Responses

Response KeyTypeDetails
dataobjectIdentity object updated.

Valid

Response Code: 200 OK
Response Headers:
	content-type: application/json
{
  "data": {
      "id": "7nxe3yjmeq28vp0k",
      "email": "pedro@test.com",
      "name": "Pedro Doe",
      "reply_to_email": "test@test.com",
      "reply_to_name": "Test Doe",
      "is_verified": false,
      "resends": 0,
      "add_note": false,
      "personal_note": null,
      "domain": {
          "id": "7nxe3yjmeq28vp0k",
          "name": "test.com",
          "created_at": "2022-11-29T10:43:22.000000Z",
          "updated_at": "2022-11-29T10:43:32.000000Z"
      }
  }
}

Invalid

Response Code: 422 Unprocessable Entity

See - Validation errors

Error

Response Code: 404 Not Found

Delete a sender identity

If you want to delete a sender identity, use this DELETE request:

DELETE https://api.mailersend.com/v1/identities/{identity_id}

Request parameters

URL parameterTypeRequiredLimitationsDetails
identity_idstringyes
use MailerSend\MailerSend;

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

$mailersend->senderIdentity->delete('identityId');

More examples

Responses

Valid

Response Code: 204 No Content

Error

Response Code: 404 Not Found

Delete a sender identity by email

If you want to delete a sender identity by email, use this DELETE request:

DELETE https://api.mailersend.com/v1/identities/email/{email}

Request parameters

URL parameterTypeRequiredLimitationsDetails
emailstringyes
use MailerSend\MailerSend;

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

$mailersend->senderIdentity->deleteByEmail('email');

More examples

Responses

Valid

Response Code: 202 Accepted

Error

Response Code: 404 Not Found

Resend a sender identity verification

If you want to resend the verification email for a sender identity, use this POST request:

POST https://api.mailersend.com/v1/identities/{identity_id}/resend

Request parameters

URL parameterTypeRequiredLimitationsDetails
identity_idstringyes
use MailerSend\MailerSend;

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

$mailersend->senderIdentity->resend('identityId');

More examples

Responses

Valid

Response Code: 200 OK
Response Headers:
	content-type: application/json
{
  "data": {
    "id": "7nxe3yjmeq28vp0k",
    "email": "john@test.com",
    "name": "John Doe",
    "reply_to_email": null,
    "reply_to_name": null,
    "is_verified": false,
    "resends": 1,
    "add_note": false,
    "personal_note": null,
    "domain": {
      "id": "7nxe3yjmeq28vp0k",
      "name": "test.com",
      "created_at": "2022-11-29T10:43:22.000000Z",
      "updated_at": "2022-11-29T10:43:32.000000Z"
    }
  }
}

Error

Response Code: 404 Not Found

Identity limit error

Response Code: 403 Forbidden
Response Headers:
	content-type: application/json
{
  "message": "You've reached the maximum sender identity limit. Upgrade to add more identities."
}

Resend limit error

Response Code: 429 Too Many Requests
Response Headers:
	content-type: application/json
{
  "message": "Limit of max 3 emails was reached. Contact support if you need additional help."
}

On this page