Skip to main content
GET
/
validate_token
Validate Token
curl --request GET \
  --url https://api.example.com/validate_token
{
  "message": "<string>"
}
This endpoint validates whether a Bearer access token is still valid and can be used for authenticated requests.
This endpoint requires authentication. Include a valid Bearer token in the Authorization header.

Authentication

This endpoint uses HTTPBearer security. Include the access token you want to validate:
Authorization: Bearer <access_token>

Response

message
string
Confirmation message that the token is valid

Status Codes

  • 200: Token is valid
  • 404: Token is not valid (URL associated with token not found)
  • 403: Invalid or expired token

How It Works

  1. The endpoint decodes the Bearer token
  2. Extracts the url_id from the token payload
  3. Retrieves the associated url_code
  4. Verifies that the URL still exists in the URLStats collection
  5. Returns a success message if valid
This endpoint is useful for:
  • Checking token validity before making other API calls
  • Implementing client-side session validation
  • Verifying tokens in middleware or authentication flows
  • Determining if a token refresh is needed
curl -X GET https://api.example.com/validate_token \
  -H "Authorization: Bearer <access_token>"

Token Expiration

Tokens expire after a configured time period (default: 5 minutes). If your token has expired, use the /refresh_token endpoint to obtain a new access token.

Build docs developers (and LLMs) love