Skip to main content
The API uses bearer API keys. Each key belongs to one organisation and carries a set of scopes that decide what it can do.
A request without a valid key answers 401. A request whose key lacks the scope for the endpoint answers 403.

API keys

A key is the prefix saasybill_live_ followed by 43 random characters.
The prefix tells a person, and a secret scanner, what the string is. If a key ends up in a public repository, the scanner can find it.
Treat a key like a password. It can create subscriptions and read customer data. Never put it in browser code, a mobile app or a repository. Keep it on your server, in an environment variable or a secrets manager.

Create an API key

Only an owner or admin can create, view or revoke keys.
1

Open Developer Settings

Go to Organisation Settings, then Developer Settings, then API Keys.
2

Create the key

Click Create API Key and fill in the fields.
3

Copy the key

Click Create Key, then copy the key from the Your New API Key dialog. It cannot be shown again. If you lose it, create a new key and revoke the old one.
An organisation can have up to 25 active keys. The list shows each key’s name, its first few characters, its scopes, when it was last used, and when it expires.

Revoke an API key

Open the key’s menu and click Revoke Key. Anything using the key stops working straight away, and this can’t be undone.

Key status


Scopes

A scope grants access to one part of the API. An endpoint names the one scope it needs. A write scope does not include its read scope. A key that creates subscriptions and also needs to read them holds both subscriptions:write and subscriptions:read.
Give each integration its own key with the fewest scopes it needs. A signup integration usually needs catalogue:read, customers:read and subscriptions:write. A reporting integration needs only read scopes.
When a key lacks a scope, the error names it.

Test keys

Keys with the prefix saasybill_test_ exist in the format but can’t be created yet. If one authenticates, the API refuses it with 403 sandbox_not_available, so nothing runs against live data by accident. To test an integration, use a second organisation connected to a Xero Demo Company. See Testing.

Authentication errors

See Errors for the full list.