Skip to main content

Token - Token Check

Endpoint​

/o/token/check

Overview​

Checks whether a token exists and is currently valid.

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.
tokenStringYesToken value to validate.

Examples​

Example 1: Check token validity​

/o/token/check?api_key=YOUR_API_KEY&token=0e1c012f855e7065e779b57a616792fb5bd03834

Response​

Success Response​

Valid token:

{
"result": {
"valid": true,
"time": 1800
}
}

Invalid or expired token:

{
"result": {
"valid": false,
"time": 0
}
}

Response Fields​

FieldTypeDescription
result.validBooleanWhether the token is valid now.
result.timeNumberRemaining lifetime in seconds (0 invalid/expired, -1 for no-expiry tokens).

Error Responses​

Status Code: 400 Bad Request

{
"result": "Missing parameter \"token\""
}

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
Valid tokenToken exists and is not expiredReads token metadata, computes remaining lifetime in seconds (-1 for non-expiring).Wrapped { "result": { "valid": true, "time": ... } }
Invalid tokenToken missing or expiredReturns invalid status with zero remaining lifetime.Wrapped { "result": { "valid": false, "time": 0 } }
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersAuth validationResolves authenticated member.
countly.auth_tokensToken check sourceReads token state and expiry fields.