Skip to content
Last updated

Endpoint:

POST https://api.mailjet.com/v1/REST/tokens

You can create a token to authenticate requests and manage permissions for different operations

Body Parameters

NameTypeDescription
NamestringRequired. A unique identifier for the token.
Permissionsarray of stringsList of permissions assigned to the token. See full list of permissions.
ExpiresInDaysintegerNumber of days until it expires. Default: 365 days.
ExpiresAtDate RFC3339Date at which the token expires

Example Request

curl -X POST -H "Authorization: Basic bWFpbGpldDpyb2Nrcw==" https://api.mailjet.com/v1/rest/tokens -d '{
 "Name": "marketing team",
 "Permissions": [
    "read_template_marketing",
    "create-template_marketing",
    "update_template_marketing"
 ],
 "ExpiresAt": "2024-01-25T17:42:46.705583Z"
}'

Status code: 201

Response Data Field Structure

NameTypeDescription
IDintegerThe ID of the token.
NamestringRequired. A unique identifier for the token.
Permissionsarray of stringsList of permissions assigned to the token. See full list of permissions.
AccessTokenstringThe token value to use for authentication
ExpiresAtDate RFC3339Date at which the token expires
CreatedAtDate RFC3339Date on which the token was created
UpdatedAtDate RFC3339Date on which the token was last updated

API Response Example

{
    "Count": 1,
    "Total": 1,
    "Data": [
        {
            "ID": 46,
            "UserID": 2,
            "OrganisationID": 2,
            "AccessToken": "612d5125131d406081abb9cd2afdc4e3",
            "Name": "marketing team",
            "Permissions": [
                "read_template_marketing",
                "create-template_marketing",
                "update_template_marketing"
            ],
            "CreatedAt": "2024-05-23T08:45:29.186711Z",
            "UpdatedAt": "2024-05-23T08:45:29.186711Z"
        }
    ]
}