Skip to main content

Overview

The Reelevant API uses OAuth 2.0 for authentication. Four grant types are supported: All token operations use the endpoint POST https://api.reelevant.com/v2/auth/token. A client_id is required for every grant. For client_credentials, HTTP Basic can supply it instead of the request body. Contact [email protected] to obtain one.

Authorization Code Flow (PKCE)

This is the recommended flow for web applications. It uses a browser redirect to authenticate the user, then exchanges an authorization code for tokens.

Step 1: Generate PKCE Challenge

Generate a random code_verifier and derive the code_challenge:

Step 2: Redirect to Authorize

Redirect the user’s browser to the authorization endpoint:
The user sees a login page. After successful authentication, a consent screen is shown. Upon approval, the browser is redirected to your redirect_uri with an authorization code:
Authorization codes are single-use and expire after 60 seconds. Exchange them immediately.

Step 3: Exchange Code for Tokens

The code_verifier must match the code_challenge sent in Step 2 (the server verifies SHA256(code_verifier) == code_challenge). Response:
Some OAuth clients are configured with requireAuthorizationCodeFlow: true. For these clients, PKCE parameters are mandatory — the implicit flow is disabled entirely.

Password Grant

For service accounts and automation scripts where browser-based login is not practical.
Response:

Two-Factor Authentication (OTP)

If the user has OTP enabled, include the x-otp-code field:

Refresh Token Grant

Exchange a valid refresh token for a new access token without re-authenticating:
Response:

Client Credentials Grant (Service Accounts)

Set REELEVANT_CLIENT_ID and REELEVANT_CLIENT_SECRET in the integration environment. Keep the secret outside source control. This example caches the access token in memory and requests another one 60 seconds before expiry. A service account and its client secret are created by an admin; see the service account guide. Send grant_type=client_credentials, client_id, and client_secret as JSON or application/x-www-form-urlencoded. You can instead send the credentials in an HTTP Basic header:
Load these values from a secrets manager or protected environment; do not type the secret into commands or shell history. When an HTTP Basic header is present, its credentials take precedence over body credentials. A malformed Basic header is rejected and does not fall back to the body. Response:
The response does not include a refresh_token. Access tokens expire after one hour; request another token with the client credentials when needed. Successful responses include Cache-Control: no-store and Pragma: no-cache. Up to two client secrets can be active at once, allowing rotation. Revoking a secret also revokes access tokens issued with that secret. Disabling the service account immediately blocks new grants and invalidates its existing access tokens.

Using Access Tokens

Include the access token in every API request via the Authorization header:

Token Lifecycle

Refresh tokens use a rolling expiry: the 30-day window resets each time you use the refresh token. If you refresh at least once a month, the token never expires.

Revoking Tokens

Revoke an access token or refresh token:
Revoking a refresh token also revokes all access tokens derived from it. Revoking a client secret also revokes access tokens issued with that secret. Disabling its service account invalidates all of its access tokens.

SCIM Provisioning

Inbound provisioning uses company-scoped bearer tokens instead of OAuth user tokens. See SCIM 2.0 provisioning.

SSO Authentication

Companies with SSO configured are automatically redirected to their identity provider during the OAuth authorize flow. If SSO is mandatory for the company, password-based login is disabled (except for service accounts).

Error Handling

A disabled service account returns UserDisabled.

Service accounts

Create service accounts and manage their client secrets.

Authentication & SSO

Review platform authentication options and integration patterns.