Skip to main content

Restrict API access to your IP addresses

Allowlist your servers' IP addresses, so that a stolen access token can't make GraphQL or REST Admin API requests from anywhere else.


An access token that leaks through a log, a bundle, or a compromised dependency works from any machine that holds it. With an IP allowlist, Shopify rejects GraphQL Admin API and REST Admin API requests that use your app's tokens from outside your ranges with a 403 status code, so the token can't call those APIs from anywhere but your own infrastructure.

Expiring tokens limit how long a leaked token works. An allowlist limits where. Use both.

Think of the two as layers. If someone steals an expiring token, then it stops working within an hour. With an allowlist, it doesn't work during that hour either, unless the request comes from your own servers.

An allowlist won't stop every attack, but it stops the low-effort ones. For example, someone who copies a token out of a log can't use it from their own machine. An allowlist is required for public apps, and for custom apps that you install on stores outside your organization. Set one up for every other app too.


Allow the public IP addresses that your app's requests leave from, such as your NAT gateway's. If those addresses change, then allow your hosting provider's ASNs instead. To get started, see Restrict API access with an IP allowlist.


Make a GraphQL Admin API request with one of your app's tokens from outside your allowed ranges, and confirm that it fails with a 403 status code. Then alert on 403 responses from your own servers, which mean an address you forgot to list.


Was this page helpful?