# Tokens

# Create a token

Create an API token.

# Request

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

# Request Body

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

# Request Body Parameters

JSON parameters are provided in dot notation

JSON Parameter Type Required Limitations Details
name string yes
domain_id string no
scopes array yes
# Possible scopes
 [
     "email_full",
     "domains_read",
     "domains_full",
     "activity_read",
     "activity_full",
     "analytics_read",
     "analytics_full",
     "tokens_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 a token.

# Request

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

# Request Body

{
  "status": "pause"
}

# Request Body 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 a token.

# Request

DELETE  https://api.mailersend.com/v1/tokens/{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/5/2020, 2:54:42 PM