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
pageintno
limitintnoMin: 10, Max: 100Default: 25
use MailerSend\MailerSend;

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

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

More examplesopen in new window

import 'dotenv/config';
import { MailerSend } from "mailersend";

const mailerSend = new MailerSend({
  apiKey: process.env.API_KEY,
});

mailerSend.email.identity.list()
    .then((response) => console.log(response.body))
    .catch((error) => console.log(error.body));

More examplesopen in new window

require "mailersend-ruby"

ms_sender_identity = Mailersend::SenderIdentity.new
ms_sender_identity.list

More examplesopen in new window

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

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 examplesopen in new window

import 'dotenv/config';
import { MailerSend } from "mailersend";

const mailerSend = new MailerSend({
  apiKey: process.env.API_KEY,
});

mailerSend.email.identity.single("identity_id")
    .then((response) => console.log(response.body))
    .catch((error) => console.log(error.body));

More examplesopen in new window

require "mailersend-ruby"

ms_sender_identity = Mailersend::SenderIdentity.new
ms_sender_identity.single(identity_id: 'idofidentity123')

More examplesopen in new window

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 examplesopen in new window

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
}
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\SenderIdentity;

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

$mailersend->senderIdentity->create(
(new SenderIdentity('domainId', 'name', 'email'))
->setReplyToName("John Doe")
->setReplyToEmail("john@test.com"))
->setAddNote(true)
->setPersonalNote("Hi John, please use this token")
);

More examplesopen in new window

import 'dotenv/config';
import { MailerSend, Inbound, InboundFilterType } from "mailersend";

const mailerSend = new MailerSend({
  apiKey: process.env.API_KEY,
});

const identity = new Identity()
    .setDomainId('domain_id')
    .setEmail('identity@yourdomain.com')
    .setName('Name')
    .setReplyToEmail('reply_identity@yourdomain.com')
    .setReplyToName('Reply Name')
    .setAddNote(false);

mailerSend.email.identity.create(identity)
    .then((response) => console.log(response.body))
    .catch((error) => console.log(error.body));

More examplesopen in new window

require "mailersend-ruby"

ms_sender_identity = Mailersend::SenderIdentity.new
ms_sender_identity.add(domain_id: 'idofdomain12412', name: 'yourname', email: 'youremail')

More examplesopen in new window

Request Parameters

JSON parameters are provided in dot notation

JSON ParameterTypeRequiredLimitationsDetails
domain_idstringyes
namestringyesMax 191 characters.
emailstringyesMax 191 characters, unique
reply_to_emailstringno
reply_to_namestringno
add_notebooleanno
personal_notestringnoMax 250 characters.

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": true,
        "personal_note": "Hi Pedro, please confirm this email by clicking on the link below.",
        "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

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",
  "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
}
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\SenderIdentity;

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

$mailersend->senderIdentity->update(
'identityId',
(new SenderIdentity('domainId', 'name', 'email'))
->setReplyToName("John Doe")
->setReplyToEmail("john@test.com"))
->setAddNote(true)
->setPersonalNote("Hi John, please use this token")
);

More examplesopen in new window

import 'dotenv/config';
import { MailerSend, Inbound, InboundFilterType } from "mailersend";

const mailerSend = new MailerSend({
  apiKey: process.env.API_KEY,
});

const data = {
  domain_id: 'string',
  email: 'email@yourdomain.com',
  name: 'name',
  personal_note: 'Personal note',
  reply_to_name: 'Reply Name',
  reply_to_email: 'repy@yourdomain.com',
  add_note: true,
};

mailerSend.email.identity.update('identiy_id', data)
    .then((response) => console.log(response.body))
    .catch((error) => console.log(error.body));

More examplesopen in new window

require "mailersend-ruby"

ms_sender_identity = Mailersend::SenderIdentity.new
ms_sender_identity.update(identity_id: 'idofidentity123', reply_to_email: 'replyemail', reply_to_name: 'replyname')

More examplesopen in new window

Request Parameters

URL parameterTypeRequiredLimitationsDetails
identity_idstringyes

JSON parameters are provided in dot notation

JSON ParameterTypeRequiredLimitationsDetails
namestringnoMax 191 characters.
reply_to_emailstringnoMax 191 characters.
reply_to_namestringno
add_notebooleanno
personal_notestringno

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": true,
      "personal_note": "Hi Pedro, please confirm this email by clicking on the link below.",
      "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

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",
  "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
}
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\SenderIdentity;

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

$mailersend->senderIdentity->updateByEmail(
'email',
(new SenderIdentity('domainId', 'name', 'email'))
->setReplyToName("John Doe")
->setReplyToEmail("john@test.com"))
->setAddNote(true)
->setPersonalNote("Hi John, please use this token")
);

More examplesopen in new window

Request Parameters

URL parameterTypeRequiredLimitationsDetails
emailstringyes

JSON parameters are provided in dot notation

JSON ParameterTypeRequiredLimitationsDetails
namestringnoMax 191 characters.
reply_to_emailstringnoMax 191 characters.
reply_to_namestringno
add_notebooleanno
personal_notestringno

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": true,
      "personal_note": "Hi Pedro, please confirm this email by clicking on the link below.",
      "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

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 examplesopen in new window

import 'dotenv/config';
import { MailerSend } from "mailersend";

const mailerSend = new MailerSend({
  apiKey: process.env.API_KEY,
});

mailerSend.email.identity.delete("identity_id")
    .then((response) => console.log(response.body))
    .catch((error) => console.log(error.body));

More examplesopen in new window

require "mailersend-ruby"

ms_sender_identity = Mailersend::SenderIdentity.new
ms_sender_identity.delete(identity_id: 'idofidentity123')

More examplesopen in new window

Responses

Valid

Response Code: 200 OK

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 examplesopen in new window

Responses

Valid

Response Code: 200 OK

Error

Response Code: 404 Not Found
Last Updated: