Skip to content
Last updated

Update a Token

Endpoint:

PUT https://api.mailjet.com/v1/REST/tokens/id Updating a token allows you to modify its properties, such as its name or permissions, to reflect changes in your security policies or operational requirements. You should also use this endpoint to renew a token.

URL Parameters: `id' = The ID of the token.

Body Parameters

NameTypeDescription
NamestringRequired. Name of the existing token.
Permissionsarray of stringsList of permissions assigned to the token. See full list of permissions.
ExpiresAtDate RFC3339Date at which the token expires

Example Request

curl --request PUT \
  --url https://api.mailjet.com/v1/rest/tokens/1 \
  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3' \
  --header 'Content-Type: application/json' \
    --data '{
	"Permissions": [
        "read_template_marketing",
        "create-template_marketing",
        "update_template_marketing"
    ],
	"Name": "marketing team"
}'

Status code: 200

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.
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 Exmaple

{
    "Count": 1,
    "Total": 1,
    "Data": [
        {
            "ID": 32,
            "UserID": 6,
            "OrganisationID": 10,
            "AccessToken": null,
            "Name": "marketing team",
            "Permissions": [
                "read_template_marketing",
                "create-template_marketing",
                "update_template_marketing"
            ],
            "CreatedAt": "2024-04-19T08:57:00.195202Z",
            "UpdatedAt": "2024-04-19T10:16:20.290549Z"
        }
    ]
}