Skip to content

Scopes ​

Ask only for the scopes your app needs. Third-party apps show them to the user on the consent screen, with the descriptions below.

The scope schema ​

Scopes follow one schema:

FormGrants
resourcefull access (includes reading)
resource:readread-only access
resource:clientaccess to what the app created itself; only for app tokens (client credentials) of trusted apps, not for personal access tokens

In the PHP SDK all scopes are constants on Anikeen\Id\Enums\Scope, e.g. Scope::ORDERS_READ for orders:read.

A shop that sells orders and subscriptions typically asks for:

text
user:read addresses:read payment-methods:read orders subscriptions

user (full access) passes every endpoint below except preferences, but the consent screen shows it as full access to the account: prefer the narrow scopes.

Anikeen ID scopes ​

ScopeConstantDescription
userUSERFull access to all user data and resources (create, view, edit, delete). Needed to change the profile.
user:readUSER_READView user information (id, email, name, username)
addressesADDRESSESFull access to all addresses
addresses:readADDRESSES_READView all address information
billingBILLINGFull access to all billing settings and invoices
billing:readBILLING_READView billing information
billing:clientBILLING_CLIENTBilling settings and invoices created through this app or token only; marks the app token for charges and the billing limit
invoicesINVOICESFull access to all invoices
invoices:readINVOICES_READView all invoice information
invoices:clientINVOICES_CLIENTInvoices created through this app or token only
ordersORDERSFull access to all orders (create, edit, cancel)
orders:readORDERS_READView order information
orders:clientORDERS_CLIENTOrders created through this app or token only; app token for app orders
payment-methodsPAYMENT_METHODSFull access to all payment methods
payment-methods:readPAYMENT_METHODS_READView payment method information
subscriptionsSUBSCRIPTIONSFull access to all subscriptions (create, edit, cancel)
subscriptions:readSUBSCRIPTIONS_READView subscription information
subscriptions:clientSUBSCRIPTIONS_CLIENTSubscriptions created through this app or token only; app token for app subscriptions and checkout sessions
transactionsTRANSACTIONSFull access to all transactions
transactions:readTRANSACTIONS_READView transaction information
transactions:clientTRANSACTIONS_CLIENTTransactions created through this app or token only
ssh-keysSSH_KEYSFull access to all SSH keys
ssh-keys:readSSH_KEYS_READView SSH key information
preferencesPREFERENCESView and change the user's shared preferences, such as the appearance
preferences:readPREFERENCES_READView the user's shared preferences
preferences:clientPREFERENCES_CLIENTLets a trusted app store preferences of its users in its own namespace, as registered by Anikeen

Scopes alone don't grant access to app features

Any client can request any scope. Features for trusted apps (charges, the billing limit, preferences of other users, …) are additionally enabled for your app by Anikeen; the :client scope only labels the app token.

Anikeen Console scopes ​

The Anikeen Console accepts personal access tokens and OAuth tokens (no client credentials) with these scopes for its product and reseller APIs:

ScopeConstantGrants
products:readPRODUCTS_READview the products of your teams
reseller-customers:readRESELLER_CUSTOMERS_READview a reseller team's customers and invitations
reseller-customersRESELLER_CUSTOMERSmanage customers: invite, resend, remove logins (includes reading)
reseller-grantsRESELLER_GRANTSgrant customers access to products and revoke it
reseller-ordersRESELLER_ORDERSorder products for customers, charged right away without confirmation

A full reseller scope includes reading. user and * do not open the reseller endpoints: the token has to carry the reseller scope itself.

Product family scopes beta ​

Each product family of the Console has its own pair of scopes: the full scope reads, changes and orders products of that family, :read only reads them.

FamilyFull scopeRead-only scope
Servers (with their floating IPs)console-servers (CONSOLE_SERVERS)console-servers:read
Containersconsole-containers (CONSOLE_CONTAINERS)console-containers:read
Domainsconsole-domains (CONSOLE_DOMAINS)console-domains:read
DNS zonesconsole-zones (CONSOLE_ZONES)console-zones:read
Web hostingconsole-hosting (CONSOLE_HOSTING)console-hosting:read
Load balancersconsole-load-balancers (CONSOLE_LOAD_BALANCERS)console-load-balancers:read
Object storageconsole-object-storage (CONSOLE_OBJECT_STORAGE)console-object-storage:read

A trusted app acting in the Console for its users asks for these scopes in the login (e.g. console-containers); for app tokens the Console accepts only them, not user. Personal access tokens may use them too, or user / products:read.

Scopes per endpoint ​

Every endpoint called with a token of the user (OAuth login or personal access token) needs a scope. Reads take <resource>:read or <resource>, changes <resource>. * and user pass everywhere in this table except preferences; user:read only reads the user. The :client scopes belong to app tokens and open none of these endpoints.

Personal access tokens can't carry :client scopes. The settings page doesn't offer them, and creating a token with one is refused (422, with an error on the scope). Tokens created earlier with a :client scope keep it, but it opens nothing; create a new token with <resource>:read or <resource> instead.

Rollout

Anikeen ID first logs requests without the scope and still answers them, so we can tell apps that would break; later it refuses them with 403 and {"message": "Invalid scope(s) provided.", "error": "missing_scope", "scopes": [...]} (scopes: any one of them passes). Check that your app asks for the scopes of every endpoint it calls; users have to sign in again to grant new scopes (a refresh keeps the old ones). Profile changes and preferences were enforced from the start.

EndpointRead with (any of)Change with
GET /v1/useruser:read, user (without: only id)
GET /v1/user/socialite-users, POST /v1/user/profile (profile page link)user:read, user
PATCH /v1/user/profile, POST/DELETE /v1/user/profile/avataruser
GET /v1/billingbilling:read, billing
POST /v1/billing/charge, POST /v1/billing/portalbilling
GET /v1/addresses, /v1/addresses/{id}addresses:read, addresses
POST, PUT, DELETE /v1/addresses…addresses
GET /v1/invoices, /v1/invoices/{id}invoices:read, invoices, billing:read, billing
GET /v1/transactions, /v1/transactions/{id}transactions:read, transactions
GET /v1/orders… (orders, items, shipments, delivery notes)orders:read, orders
POST, PUT, DELETE /v1/orders…, …/checkout, …/revoke, items, POST …/shipmentsorders
GET /v1/payment-methods, /{id}, /defaultpayment-methods:read, payment-methods
POST, DELETE /v1/payment-methods…, PUT …/{id}/defaultpayment-methods
GET /v1/subscriptions…, GET /v1/checkout-sessions/{id}subscriptions:read, subscriptions
POST, PUT /v1/subscriptions… (checkout, revoke, pause, resume), POST /v1/checkout-sessions…subscriptions
GET /v1/ssh-keys…ssh-keys:read, ssh-keys
POST, PUT, DELETE /v1/ssh-keys…ssh-keys
/v1/preferences/global…preferences:read, preferences (not user)preferences (not user)

App tokens (/v1/client/*, /v1/admin/*) keep their own checks, see trusted apps. Public endpoints (countries, products, orders/preview, avatars) need no token.

Checking scopes in your own API ​

If your API accepts Anikeen ID tokens, read the scopes from the token's scopes claim (see Access tokens). * stands for all scopes. With the SDK use anikeenTokenCan() or the scope middleware, see API token guard.

Anikeen ID developer documentation