Skip to content
The API is in beta and may change without prior notice.

Token Types

HitKey uses several types of tokens. Understanding the difference is important for a correct integration.

OAuth2 Tokens

These are issued through the OAuth2 flow and used to access HitKey's API on behalf of a user.

Access Token

PropertyValue
Lifetime1 hour
UsageAuthorization: Bearer <token> header
Endpoint/oauth/userinfo
Obtainable via/oauth/token (code exchange or refresh)

Access tokens are short-lived. When one expires, use the refresh token to get a new one.

Refresh Token

PropertyValue
Sliding window30 days (resets on each use)
Absolute cap90 days (maximum lifetime)
UsagePOST /oauth/token with grant_type=refresh_token
RotationNo — the same refresh token remains valid

INFO

OAuth refresh tokens are not rotated — the same refresh token can be reused until it expires. Only the access token is refreshed.

This is different from API Bearer token refresh (POST /auth/token/refresh), which does rotate the refresh token.

Authorization Code

PropertyValue
Lifetime10 minutes
UsageSingle-use, exchanged for access + refresh token
FlowReceived via redirect after user authorization

API Bearer Tokens

These are HitKey's internal authentication tokens, used for direct API access (not OAuth2).

PropertyValue
Issued viaPOST /auth/login
Prefixhitkey_
UsageAuthorization: Bearer <token> header
EndpointsAll /auth/*, /projects/*, /oauth/clients
RefreshPOST /auth/token/refreshrotates refresh token

When to use which

  • OAuth2 tokens — when your app accesses HitKey on behalf of a user (the standard partner integration)
  • API Bearer tokens — when a user interacts with HitKey directly (the HitKey dashboard uses these)

As a partner developer, you'll primarily work with OAuth2 tokens.

Token Storage Best Practices

TokenStore whereNotes
Access tokenMemory or secure storageShort-lived, ok to refetch
Refresh tokenServer-side secure storageNever expose to frontend
Client secretEnvironment variableNever in code or frontend

Token Security

  • Authorization codes are hashed (SHA-256) before storage — the API stores only the hash
  • Access and refresh tokens are also stored as hashes
  • Plaintext tokens are returned only once at creation time
  • Token exchange requires both client_id and client_secret

HitKey Service License.