Skip to content
Last updated

B2B API Quickstart Guide

This quickstart guide will help you get started with the B2B API, allowing you to make your first API call.

Step 1: Retrieve your client_id and client_secret

  1. Login your email.
  2. Look for an email from raipartners.com with subject B2B API.
  3. Grab your client_id and initial client_secret.

Your client_id and client_secret are required to authenticate all API requests.

Step 2: Make Your First API Request

Let's start by rotating your client_secret to replace your existing client_secret.

Step 1: Authenticate

Before you can call any API endpoint, you must authenticate using the client_id and client_secret originally provided by your RAI Partners' Client Success representative via email.

Retrieving JWT Token

Use the following curl command to authenticate:

curl -X POST https://api.raipartners.com/b2b/auth/token \
-H "Content-Type: application/json" \
-H 'accept: application/json' \
-H 'API-Version: 1.0.0' \
-d '{
  "client_id": "<YOUR_CLIENT_ID>",
  "client_secret": "<YOUR_CLIENT_SECRET>"
}'
  • client_id: The client_id assigned to your company.
  • client_secret: The associated client secret.

Response Example:

{
  "scope": "read:user write:user",
  "refresh_expires_in": 300,
  "token_type": "Bearer",
  "not-before-policy": 0,
  "access_token": "eyo.....",
  "expires_in": 300
}

Rotating the client_secret

Grab the access_token value from the authentication cal then use the following curl command to rotate the client_secret:

curl -X POST https://api.raipartners.com/b2b/auth/client-secret/rotation \
-H "Content-Type: application/json" \
-H 'accept: application/json' \
-H 'API-Version: 1.0.0' \
-H Authorization: Bearer YOUR_ACCESS_TOKEN

Response Example

{
  "secret": "PX4eWb9rcRT1RBqvLw4GtuqyoUFWoGLr"
}

This response confirms that the client_secret has been successfully rotated and provides the new client_secret.