Skip to main content

Overview

The Reelevant API uses OAuth 2.0 for authentication. Three 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. 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:

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.

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