API resources and machines
An API resource represents one of your own APIs that applications can get access tokens for. API resources are available on the Paid plan.
Adding an API
Section titled “Adding an API”- Under API resources, add your API and give it an identifier. This is usually its URL, such as
https://api.example.com, and it becomes theaudof access tokens for it. - Add the scopes it understands, such as
orders:readandorders:write, each with a short description. People see these descriptions on the consent screen. - Choose who can use the API: your own applications, third-party applications, AI agents that registered themselves, or any combination. For each, choose which scopes they’re allowed.
Asking for a token
Section titled “Asking for a token”An application names the API with the resource parameter (RFC 8707), and asks for its scopes in scope:
GET /oauth2/authorize?client_id=…&response_type=code&resource=https://api.example.com &scope=openid orders:read&code_challenge=…&code_challenge_method=S256&redirect_uri=…The access token it receives has aud: https://api.example.com, and includes the scopes it was allowed.
Machine-to-machine applications
Section titled “Machine-to-machine applications”A machine-to-machine application calls your APIs on its own behalf, with no user involved. It gets tokens with the client credentials grant:
curl -u "$CLIENT_ID:$CLIENT_SECRET" https://acme.authn.co.uk/oauth2/token \ -d grant_type=client_credentials -d resource=https://api.example.com -d scope=orders:readThe token’s sub is the application’s own client ID. You decide which APIs and scopes it can use with grants on the application’s page.
The Admin API
Section titled “The Admin API”Every project also comes with the Admin API for managing its users. To use it, give a machine-to-machine application the users:read or users:write scope.