Revoke an API token
curl --request DELETE \
--url https://my.server.express/api/v1/user/tokens/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://my.server.express/api/v1/user/tokens/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://my.server.express/api/v1/user/tokens/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text){
"success": true,
"data": {
"id": "<string>",
"alreadyRevoked": true
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}API Tokens
Revoke an API token
Soft revoke: the row stays, so a later call with the token is told it was revoked rather than invalid. Revoking an
already-revoked token is a success with alreadyRevoked: true. Another user’s token id is 404. Writes an
API_TOKEN_REVOKED audit entry.
DELETE
/
v1
/
user
/
tokens
/
{id}
Revoke an API token
curl --request DELETE \
--url https://my.server.express/api/v1/user/tokens/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://my.server.express/api/v1/user/tokens/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://my.server.express/api/v1/user/tokens/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text){
"success": true,
"data": {
"id": "<string>",
"alreadyRevoked": true
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}