All API access is authenticated using OAuth 2.0. Your app receives access tokens that are scoped to the specific permissions each merchant granted during installation. Base URL:Documentation Index
Fetch the complete documentation index at: https://docs.orderprotection.com/llms.txt
Use this file to discover all available pages before exploring further.
Authorization Code Flow
This is the primary flow for apps installed by merchants. When a merchant installs your app from the marketplace, OrderProtection delivers an authorization code to your redirect URI. You exchange this code for access and refresh tokens.1. Merchant installs your app
When a merchant clicks Install on your app, they review and approve the requested scopes. OrderProtection then sends an authorization code to your redirect URI:| Parameter | Description |
|---|---|
code | The authorization code to exchange for tokens |
state | The state parameter you provided (if any), for CSRF protection |
2. Exchange code for tokens
Exchange the authorization code for an access token and refresh token:Token response
| Field | Description |
|---|---|
access_token | Bearer token for API calls. Prefixed with op_at_. |
token_type | Always Bearer. |
expires_in | Token lifetime in seconds (3600 = 1 hour). |
refresh_token | Long-lived token to obtain new access tokens. Prefixed with op_rt_. |
scope | Space-separated list of granted scopes. |
PKCE support
The authorization code flow supports PKCE (Proof Key for Code Exchange) with the S256 method for enhanced security. If acode_challenge was provided during authorization, you must include the code_verifier when exchanging the code:
Client Credentials Flow
Use this flow for server-to-server access when no user interaction is needed. This is useful for background jobs, data sync, or admin operations.The client credentials flow requires an existing installation on the target store. A merchant must have already installed your app (granting scopes) before you can use this flow. The
store_id parameter tells OrderProtection which installation to use for determining your granted scopes.The
scopes parameter is optional and acts as a filter. If omitted, the token will include all scopes granted by the merchant during installation.Refreshing tokens
Access tokens expire after 1 hour. Use the refresh token to obtain a new access token without requiring the merchant to re-authorize:Revoking tokens
When a merchant disconnects your app or you need to invalidate tokens, revoke them explicitly:| Parameter | Required | Description |
|---|---|---|
token | Yes | The token to revoke |
client_id | Yes | Your app’s client ID |
client_secret | Yes | Your app’s client secret |
token_type_hint | No | Either access_token or refresh_token |
Using access tokens
Include the access token in theAuthorization header of every API request:
Token prefixes
OrderProtection tokens use prefixes for easy identification:| Prefix | Type |
|---|---|
op_at_ | Access token |
op_rt_ | Refresh token |
op_app_ | Client ID |
op_secret_ | Client secret |

