Skip to main content

Scopes API

The Scopes API lets you manage your app's access scopes at runtime. You can query which scopes are currently granted, request additional optional scopes from the merchant (which opens a permission grant modal), and revoke optional scopes you no longer need.

Tip

To learn more about declaring and requesting access scopes, as well as required vs. optional scopes, refer to manage access scopes.

  • Scope management: Query, request, and revoke optional access scopes dynamically within your app.
  • Progressive permissions: Request additional scopes only when a merchant needs specific features.
  • Scope verification: Check which scopes are currently granted before making API calls that require them.
  • Merchant consent: Trigger the merchant consent flow for optional scopes directly from your app UI.

The scopes API is available on the shopify global. All methods are asynchronous and return a Promise.

Anchor to query
query
() => Promise<>
required

Returns the current access scopes for this app on this shop, including which are granted, required, and optional.

Anchor to request
request
(scopes: string[]) => Promise<>
required

Opens a permission grant modal asking the merchant to grant the specified scopes.

The scopes must be access scope handles (for example, 'read_products' or 'write_orders') that are declared as optional in your app configuration.

See the permission grant modal documentation for more details.

Anchor to revoke
revoke
(scopes: string[]) => Promise<>
required

Revokes the specified optional scopes from this app on this shop.

The scopes must be access scope handles (for example, 'read_products' or 'write_orders') that are currently granted and declared as optional. Required scopes cannot be revoked.



Was this page helpful?