Authorization header. You obtain this token by completing the OAuth 2.0 Authorization Code flow.
Authorization Code flow
The Authorization Code flow is the standard OAuth 2.0 pattern for server-side applications. It involves two main steps: directing the user to authorize your application, then exchanging the resulting code for tokens.Redirect the user to the authorization URL
Send the user to the Flextell authorization endpoint. Include your The user logs in (if not already) and is shown a consent screen listing the permissions your application is requesting.
client_id, the redirect_uri you registered, the scopes your application needs, and response_type=code:Receive the authorization code
After the user approves, Flextell redirects them back to your This code is single-use and expires quickly. Exchange it for tokens immediately.
redirect_uri with a short-lived code parameter:Including the token in requests
Pass youraccess_token in the Authorization header on every API request:
Token expiry and refresh
Access tokens expire after the number of seconds indicated byexpires_in (typically 3600 seconds / 1 hour). When an access token expires, use your refresh_token to obtain a new one without requiring the user to re-authorize:
access_token. Some implementations also rotate the refresh_token — always store the latest values returned.
If your refresh token has also expired or been revoked, you must restart the full Authorization Code flow.
Authentication errors
When a request fails due to an authentication problem, the API returns a401 Unauthorized response:
| Cause | Resolution |
|---|---|
Missing Authorization header | Add Authorization: Bearer YOUR_ACCESS_TOKEN to the request |
| Token expired | Use your refresh token to obtain a new access token |
| Malformed token | Ensure the full token string is included without extra whitespace |
| Token revoked | Re-authenticate the user through the Authorization Code flow |
Security best practices
- Store tokens securely. Keep access tokens and refresh tokens in secure, server-side storage. Do not store them in
localStorage, cookies without theHttpOnlyflag, or unencrypted databases. - Use HTTPS everywhere. All requests to the Flextell API must be made over HTTPS. Never send tokens over plain HTTP.
- Request only the scopes you need. Limit your authorization request to the minimum scopes required for your application.
- Rotate refresh tokens. If Flextell returns a new refresh token on each refresh, discard the old one immediately and store the new one.
- Handle expiry proactively. Track the
expires_invalue and refresh the access token before it expires rather than waiting for a401response.
Quick Start
See a working end-to-end example of the auth flow.
API Reference
Explore available endpoints and their required scopes.