Skip to main content

Token - Token Delete

Endpoint

/i/token/delete

Overview

Deletes one token owned by the authenticated user.

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions

  • Any authenticated dashboard user.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)Dashboard API key.
auth_tokenStringYes (or use api_key)Dashboard auth token.
tokenidStringYesToken ID to revoke.

Examples

Example 1: Delete token

/i/token/delete?api_key=YOUR_API_KEY&tokenid=884803f9e9eda51f5dbbb45ba91fa7e2b1dbbf4b

Response

Success Response

{
"result": {
"n": 1,
"ok": 1,
"deletedCount": 1
}
}

Response Fields

FieldTypeDescription
resultObjectMongo remove result object.
result.deletedCountNumberNumber of token rows deleted.

Error Responses

Status Code: 404 Not Found

{
"result": "Token id not provided"
}

Status Code: 400 Bad Request

{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}

Status Code: 404 Not Found

{
"result": "Database error message"
}

Behavior

Behavior Modes

ModeTriggerProcessing PathResponse Shape
Delete successValid tokenid and ownership matchRemoves token by _id and owner.Wrapped DB remove result object.
Missing token idtokenid omittedRejects before DB call.Wrapped error string.

Limitations

  • Endpoint only removes tokens owned by the caller.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersAuth validationResolves authenticated member.
countly.auth_tokensToken revocation targetRemoves token row matching _id and owner.