Skip to main content

Prerequisites

You’ll need a Developer Portal account. Use the Developer Portal to create a test operator, manage API access for a connected operator account, or create a partner app. You do not need to connect a real operator account just to explore the API.
Create a test operator first if you’re exploring the API. Test operators let you try credentials, requests, and webhook setup before working with real operator data.

Choose your connection method

Choose Operator integration for your own operator account or when you manage API access on an operator’s behalf. Choose Partner app for a product that operators authorise independently. All paths use the same Authorization: Bearer <token> header for API requests. They differ in how you obtain and renew the token.
Start with Connect an account, then create credentials for that operator through the Developer Portal.

Option A: Access token

Use an expiring Access Token for one-time scripts, API exploration, or short-lived AI-agent tasks. Choose a short expiry and only the scopes your task needs. Follow Use an Access Token to create an expiring token for your test operator or connected account. Use it directly in the bearer header of your first API request.

Option B: OAuth 2.0 — Client Credentials

Use this when your backend needs ongoing access to an account you manage, without user interaction. Follow Use an OAuth Client for client creation, token exchange, authenticated requests, and renewal. OAuth access tokens expire after 2 hours. Client Credentials does not issue a refresh token. Your backend obtains a replacement access token by repeating the client_credentials exchange.

Option C: OAuth 2.0 — Authorization Code

An operator’s staff member authorises your partner app to access their data through the flow below.

Step 1: Redirect the user to authorise

Generate an unpredictable, single-use state value with a cryptographically secure random generator. Store the value in the initiating browser session on your server, with a short expiry. The state value binds the callback to the session that started the connection and protects against cross-site request forgery (CSRF). Direct the user’s browser to the following URL. Replace STATE with the value you stored:
The user logs in to Stora and approves the requested scopes. Stora redirects back to your redirect_uri with an authorisation code and the same state value:

Step 2: Validate the callback

Before exchanging the code, validate the callback on your server:
  1. Read the stored state from the browser session that initiated the connection.
  2. Check that the callback includes state and that it exactly matches the stored value.
  3. Check that the stored state has not expired or already been used.
  4. Consume the stored state so another callback cannot reuse it. Make validation and consumption atomic so concurrent callbacks cannot both succeed.
If the state is missing, mismatched, expired, or already used, reject the callback. Do not exchange the code. Require the user to start a new connection attempt.

Step 3: Exchange the code for tokens

Response:

Refreshing tokens

Access tokens expire after 2 hours. A request with an expired token returns 401 Unauthorized with the code invalid_token. Use the refresh token to get a new one without requiring the user to re-authorise:
The response includes a new access_token and a new refresh_token. The previous refresh token is revoked.

PKCE (optional)

PKCE (Proof Key for Code Exchange) protects the Authorization Code flow against code interception. Use it when your OAuth client is a single-user application running on a user-owned device — a mobile app, a desktop app, or a CLI tool.
If you’re distributing your integration as code that runs outside infrastructure you control (WordPress plugin, browser extension, client-side app extension, packaged on-premise tool, etc.), PKCE alone is not sufficient. Follow Distributing a public plugin instead — the broker pattern it describes is the safe way to keep OAuth credentials and tokens out of distributed code.
Generate a code_verifier and code_challenge before redirecting:
Add the challenge to the authorisation URL. Include the session-bound state from Step 1 and validate the callback before exchanging the code:
Include the code_verifier when exchanging the code: