Skip to main content
The RABOT Partner API uses OAuth 2.0 for authentication (see RFC 7649). Using the OAuth client credentials flow, you can obtain an access token from the RABOT authentication server.

Available Environments

For development and testing purposes, the API is also available in a test environment, where you can create and modify data without triggering actual contract and market communication / operation processes. To access the test enviroment, you have to use different hostnames for your API request.
Note that your client credentials are different between TEST and PROD environment. Remember to use the correct set of credentials depending on the environment.

Automating OAuth 2.0 Token Management

This guide shows you how to implement automated token management in your RABOT Partner API integration, ensuring your scripts maintain uninterrupted access without manual intervention.

Token Lifecycle

Key Points:
  • Tokens expire after ~1 hour (3599 seconds)
  • No refresh tokens - re-authenticate with client credentials when expired
  • Proactive token renewal recommended (don’t wait for 401 errors)

Token Request

Use your client credentials to obtain an access token:
replace CLIENT_ID and CLIENT_SECRET with the credentials you received from Rabot Charge. See Partner setup
Example API request

Scopes

You need to specify, which scopes you want to include in the token by specifying them in scope parameter.
Multiple Scopes: Separate multiple scopes with spaces, e.g., api:partner create:orders
The following scopes are available for Whitelabel Partners: The following scopes are available for HEMS / 3rd Party Partners:
In order to access further customer or contract specific information e.g. Working Price via the metrics endpoint, you will need to integrate the 3rd Party Authorization flow.Once the RABOT customer has authorized the data exchange between our platforms, you will be able to access all endpoint under the /customers path.
The following scopes are available for Sales Affilliate Partners:
To use scopes, you need to have them assigned to your API client by RABOT administrators. If you feel you should have a scope, that you don’t have, please contact our Integration Management team.

Token Response

If successful, the authentication server responds with a HTTP/200 status code, and the response body contains a structure with the access token
In all requests to the partner API, include the access token as Bearer token in the HTTP authorization header:
Example API request
Note that the token only has a limited life time; when the life time has expired, you will need to request a new token from the authentication server.

Best Practices

1. Proactive Token Renewal

Don’t wait for tokens to expire - renew them proactively:

2. Secure Credential Storage

Never hardcode credentials in your source code or commit them to version control.
Recommended approaches:

3. Error Handling

Always handle authentication errors gracefully:

4. Logging (Without Exposing Secrets)

Log authentication events, but never log tokens or credentials:

5. Thread Safety (For Multi-threaded Applications)

If your application uses multiple threads, protect token operations:

Common Issues & Solutions

Issue 1: “Invalid client credentials”

Cause: Incorrect client_id or client_secret Solution:
  • Verify credentials in your Partner setup
  • Check for typos or extra whitespace
  • Ensure you’re using the correct environment (staging vs. production)

Issue 2: “Insufficient scopes”

Cause: Requesting access to endpoints without the required scopes Solution:
  • Review available scopes for your partner type (Whitelabel, HEMS, Sales Affiliate)
  • Contact Integration Management to request additional scopes
  • Update your scope list in the authentication request

Issue 3: Frequent 401 errors

Cause: Token expiring between validation check and API request Solution:

Issue 4: High authentication rate

Cause: Re-authenticating too frequently Solution:
  • Increase buffer time to avoid premature re-authentication
  • Cache tokens in memory (don’t re-authenticate for every request)
  • Check your expiry calculation logic

Testing Your Implementation

Manual Test

Testing Checklist

  • Initial authentication works
  • Token is used in API requests (Bearer header)
  • Token expiry is calculated correctly
  • Token is renewed before expiry (proactive)
  • 401 errors trigger re-authentication
  • Credentials are not hardcoded
  • Credentials are not logged
  • Error handling is robust
  • Multi-threaded access is safe (if applicable)

Questions or Concerns?

Feel free to speak with our Integration Management Team or alternatively, ask our built-in AI assistant, Rabotini 🤖 (several languages supported).