Switch to dark mode

API Scopes

An API key's scopes decide which environment the key can use and what it can do there. You choose them when you create the key in the Dashboard. A request fails if the key lacks a scope the operation needs.

Environments

There are two separate environments, each with its own scopes:

  • Live (live): real bookings and payments.
  • Test (test): a sandbox for development and testing.

A key needs the base scope, live or test, to use that environment at all. Without it, the key's other scopes for that environment do nothing. The more specific scopes, such as live:orders:read or test:payments:wallet, add permissions on top of the base scope.

One key can have scopes for both environments, but most integrations use a separate key for each.

Available scopes

Every scope exists for both environments, with a live or a test prefix.

Scope Grants
live, test General access to the environment, including creating orders
live:orders:read, test:orders:read Search orders, and read and start refunds
live:payments:wallet, test:payments:wallet Create orders paid with wallet credits
live:payments:stripe, test:payments:stripe Create orders paid through the payment gateway (Stripe)
live:payments:invoice, test:payments:invoice Create orders paid by invoice
live:passenger_profiles:read, test:passenger_profiles:read Search passenger profiles

Choosing scopes

Give a key only the scopes it needs. A key that only looks up the status of orders it already has the id of needs nothing but live. Reading one order with node only takes the base scope.

Payment method scopes

Each payment method has its own scope. An order can only be created with a payment method if the key has the matching scope.

Which scope you need depends on the payment method of the cost center you book on. See Payment Methods for each payment flow.

Order scope

live:orders:read / test:orders:read is needed to search your orders with orders, and for everything to do with refunds: refundableItems, refunds and refundItems. Reading a single order by its id with node doesn't need it.

Passenger profile scope

Searching passenger profiles with passengerProfiles requires live:passenger_profiles:read or test:passenger_profiles:read. Without it the search fails with FORBIDDEN. Reading the signed-in user's own profile through me.profile needs no extra scope.

Keys on public pages

Keep keys with these scopes on your server:

  • orders:read reads every order on your sales agent.
  • passenger_profiles:read reads the names, contact details, birth dates and travel cards in the profiles of every company you book for.

When a public page needs to show or refund one order, such as an order confirmation page or the Refund Manager embed, mint an access token for that order instead. A token that only reads can be minted with the base scope alone. A token that can also refund the order needs orders:read and payments:stripe on the key that mints it.

Embeds that only book and pay take an API key with just the base scope and the Stripe scope, for example live and live:payments:stripe. See Configuring embeds safely.