Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > API token

Rotate API token

Returns

Returns a resource object of type access_token.

Examples

1
POST https://site-api.datocms.com/access_tokens/:access_token_id/regenerate_token HTTP/1.1
2
Authorization: Bearer YOUR-API-TOKEN
3
Accept: application/json
4
X-Api-Version: 3
Terminal window
1
curl -g 'https://site-api.datocms.com/access_tokens/:access_token_id/regenerate_token' \
2
-X POST \
3
-H "Authorization: Bearer YOUR-API-TOKEN" \
4
-H "Accept: application/json" \
5
-H "X-Api-Version: 3"
1
await fetch(
2
"https://site-api.datocms.com/access_tokens/:access_token_id/regenerate_token",
3
{
4
method: "POST",
5
headers: {
6
Authorization: "Bearer YOUR-API-TOKEN",
7
Accept: "application/json",
8
"X-Api-Version": "3",
9
},
10
},
11
);
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
Cache-Control: cache-control: max-age=0, private, must-revalidate
4
X-RateLimit-Limit: 30
5
X-RateLimit-Remaining: 28
6
7
{
8
"data": {
9
"type": "access_token",
10
"id": "312",
11
"attributes": {
12
"name": "Read-only API token",
13
"hardcoded_type": "",
14
"can_access_cda": true,
15
"can_access_cda_preview": true,
16
"can_access_cma": true
17
},
18
"relationships": {
19
"role": {
20
"data": {
21
"type": "role",
22
"id": "34"
23
}
24
}
25
}
26
}
27
}