Skip to main content
If you build a tool that acts on other merchants’ accounts, use OAuth 2.0 instead of asking them to paste an API key. Register an app in Settings > OAuth Apps with a name, redirect URIs, the scopes it may request, and whether it is confidential or public.

Flow

  1. Authorize. Send the user to
    PKCE with S256 is required for every app. The user signs in, picks one organization they own or administer and approves the scopes.
  2. Receive the code at your redirect_uri as ?code=...&state=... (or ?error=access_denied). Codes work once, for 10 minutes.
  3. Exchange it. POST /api/oauth/token, form-encoded, with grant_type=authorization_code, code, redirect_uri, code_verifier and your client credentials (HTTP Basic, or client_id and client_secret in the body; public apps send only client_id). You get { access_token, refresh_token, expires_in: 3600, scope, organization_id }.
  4. Call the API with Authorization: Bearer <access_token>. It sees only that organization and only the granted scopes.
  5. Refresh with grant_type=refresh_token. Refresh tokens last 30 days and rotate: each use returns a new pair and retires the old one. Presenting a retired token again revokes the whole authorization. A refresh may narrow scope but never widen it.
  6. Revoke with POST /api/oauth/revoke and token=... (RFC 7009).
Access stops immediately when the approving user is demoted below admin, suspended or removed, when the app is disabled or deleted, when a scope is removed from the app, or when the user withdraws the grant in Settings > OAuth Apps. Discovery metadata for OAuth libraries is at /.well-known/oauth-authorization-server. The token and revocation endpoints answer CORS (*) because they use no cookies.