# 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

# Request Body

{
  "name": "API Token",
  "domain_id": "Domain ID",
  "scopes" : ["email_full", "analytics_read"]
}

# Request parameters

JSON parameters are provided in dot notation

JSON parameter Type Required Limitations Details
name string yes
domain_id string yes
scopes array yes
# Possible scopes
 [
     "email_full",
     "domains_read",
     "domains_full",
     "activity_read",
     "activity_full",
     "analytics_read",
     "analytics_full",
     "tokens_full",
     "webhooks_full",
     "templates_full",
   ]

# Responses

# Valid

Response Code: 200 OK
Response Headers:
	Content-Type: application/json
{
  "data": {
    "id": "b74c547a741e199d29c2bb38703fc4642c486841ab568b9fddc83be12329727022f6fb98291efd62",
    "accessToken": "[redacted]",
    "name": "Token",
    "created_at": "2020-06-10 10:10:14"
  }
}

# Error

Response Code: 422 Unprocessable Entity

See - Validations errors

# Update a token

Update an API token with this PUT request:

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

# Request Body

{
  "status": "pause"
}

# Request parameters

JSON parameters are provided in dot notation

JSON parameter Type Required Limitations Details
status string no pause, unpause

# Responses

# Valid

Response Code: 200 OK
Response Headers:
	Content-Type: application/json
{
  "data": {
    "id": "b74c547a741e199d29c2bb38703fc4642c486841ab568b9fddc83be12329727022f6fb98291efd62",
    "name": "Token",
    "status": "pause",
    "created_at": "2020-06-10 10:10:15"
  }
}

# Error

Response Code: 422 Unprocessable Entity

See - Validations errors

# Delete a token

Delete an API token with this DELETE request:

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

# Request parameters

URL parameter Type Required Limitations Details
token_id string yes

# Responses

# Valid

Response Code: 200 OK
Response Body: [EMPTY]

# Error

Response Code: 404 Not Found
Last updated: 10/19/2021, 10:36:18 AM