client_id and client_secret for a short-lived access token, then attaches that token to downstream API calls. Tokens are valid for 600 seconds (10 minutes) and cannot be refreshed; request a new one using the same flow when the current one expires.
Getting Your Credentials
To obtain aclient_id and client_secret, email support@diameterpay.com. Include your company name and a brief description of your use case. The Diameter team will provision a Tenant for you and reply with sandbox credentials.
Token Endpoints
Use the sandbox endpoint during development and testing. Switch to the production endpoint only when you are ready to go live.Requesting a Token
Send aPOST request to the token endpoint with a body encoded as application/x-www-form-urlencoded. Include the four fields below.
string
required
Must be
client_credentials.string
required
The Client ID issued to your Tenant.
string
required
The Client Secret issued to your Tenant.
string
A space-separated list of OAuth scopes your token needs. Omit this field to request all scopes granted to your Tenant, or list only the scopes you need (recommended).
Token Response
A successful request returns a JSON object with three fields.Using the Token
Attach the token to every API request in theAuthorization header using the Bearer scheme.
Scopes
Scopes control which API resources a token can access. Request only the scopes your integration actually needs — this limits the blast radius if a token is ever leaked.Your Tenant may not have all scopes enabled by default. Contact support@diameterpay.com if you receive a
403 Forbidden response indicating a missing scope that you expect to have access to.Token Expiry and Rotation
Tokens expire after 10 minutes. Diameter does not support refresh tokens in the Client Credentials flow. To maintain uninterrupted access, proactively request a new token before the current one expires. The recommended pattern is to fetch a fresh token at startup and cache it in memory with a timer that triggers a re-fetch at the 9-minute mark (giving a 60-second buffer before the 10-minute expiry):Python — token caching with proactive refresh
Deprecated JWT Authentication
Diameter previously supported direct JWT-based authentication where tokens were signed and passed in a custom header. That mechanism still functions for tenants that have not yet migrated, but all new integrations must use OAuth 2.0 Client Credentials. The legacy JWT method will be removed in a future major version. If you are currently using it, contact support@diameterpay.com to plan your migration.Error Handling
Authentication errors return standard HTTP status codes with a JSON error body.401 Unauthorized — expired token
403 Forbidden — missing scope