Keys / Shopify
SHOPIFY_ACCESS_TOKEN
The access token your app sends in the X-Shopify-Access-Token header to call a store's GraphQL Admin API.
- Starts with
shpat_- Expires
- depends on the grant: 1 hour, 24 hours or never
- API
- new tokens from a grant; no endpoint deletes one token
Get it
Create one on dev.shopify.com/dashboard. The steps aren't recorded yet.
Set it
SHOPIFY_ACCESS_TOKEN=shpat_...
Shopify's @shopify/shopify-api library doesn't read it; your app passes the token in a session. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- For an app in the Dev Dashboard that acts on your own stores, exchange its client ID and secret for a token with the client credentials grant. That token lasts 24 hours, so have your app request a new one instead of storing it.
- For a non-expiring token, there's no single-token revoke; you rotate the app's client secret. Add a new secret in the Dev Dashboard, accept webhook signatures from both secrets, and switch your OAuth calls to the new one.
- Then re-pin each store's token with the rotation refresh token the Dev Dashboard issues. Re-pinning returns a new token and destroys the old one at once, so deploy each new token right away. A rotation refresh token lasts one hour.
- Once every token is re-pinned, revoke the old secret. Tokens still pinned to it stop working.
- For an older custom app made in the Shopify admin, uninstall and reinstall it to get a new token. Requests fail until you deploy the new one.
Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.