Tokens

You need to add a sending domain token to authenticate your API requests. API tokens are generated for sending domains and can have different permissions to limit which areas of your account they may be used to access.

Create a token

Create an API token with this POST request:

POST  https://api.mailersend.com/v1/token
1

Request Body

{
  "name": "API Token",
  "domain_id": "Domain ID",
  "scopes" : ["email_full", "analytics_read"]
}
1
2
3
4
5

Request parameters

JSON parameters are provided in dot notation.

JSON parameterTypeRequiredLimitationsDetails
namestringyes
domain_idstringyes
scopesarrayyes
Possible scopes
 [
     "email_full",
     "domains_read",
     "domains_full",
     "activity_read",
     "activity_full",
     "analytics_read",
     "analytics_full",
     "tokens_full",
     "webhooks_full",
     "templates_full",
     "suppressions_read",
     "suppressions_full",
     "sms_full",
     "sms_read",
   ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Responses

Valid

Response Code: 200 OK
Response Headers:
	Content-Type: application/json
1
2
3
{
  "data": {
    "id": "b74c547a741e199d29c2bb38703fc4642c486841ab568b9fddc83be12329727022f6fb98291efd62",
    "accessToken": "[redacted]",
    "name": "Token",
    "created_at": "2020-06-10 10:10:14"
  }
}
1
2
3
4
5
6
7
8

Error

Response Code: 422 Unprocessable Entity
1

See - Validation errors

Update a token

Update an API token with this PUT request:

PUT https://api.mailersend.com/v1/token/{token_id}/settings
1

Request Body

{
  "status": "pause"
}
1
2
3

Request parameters

JSON parameters are provided in dot notation.

JSON parameterTypeRequiredLimitationsDetails
statusstringnopause, unpause

Responses

Valid

Response Code: 200 OK
Response Headers:
	Content-Type: application/json
1
2
3
{
  "data": {
    "id": "b74c547a741e199d29c2bb38703fc4642c486841ab568b9fddc83be12329727022f6fb98291efd62",
    "name": "Token",
    "status": "pause",
    "created_at": "2020-06-10 10:10:15"
  }
}
1
2
3
4
5
6
7
8

Error

Response Code: 422 Unprocessable Entity
1

See - Validation errors

Delete a token

Delete an API token with this DELETE request:

DELETE  https://api.mailersend.com/v1/token/{token_id}
1

Request parameters

URL parameterTypeRequiredLimitationsDetails
token_idstringyes

Responses

Valid

Response Code: 200 OK
Response Body: [EMPTY]
1
2

Error

Response Code: 404 Not Found
1
Last Updated: