401. A request whose key lacks the scope for the endpoint answers 403.
API keys
A key is the prefixsaasybill_live_ followed by 43 random characters.
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.
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.
When a key lacks a scope, the error names it.
Test keys
Keys with the prefixsaasybill_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.