Payments and finance

Shopify API tokens: find, store, rotate, and use them safely with AI agents

Shopify Admin API access tokens for store-created custom apps are shown once in the admin under Apps → Develop apps → your app → API credentials. Shopify says you cannot create new admin-created custom apps and points new apps to the Dev Dashboard, which exchanges a client ID and secret for a token that lasts about 24 hours.

Shopify key types

TypePrefixSecret?ScopeExpiry
Admin API access token (custom app)
Displayed only when generated.
—YesThe Admin API scopes configured on the app—
Dev Dashboard client secret
Found under Settings in the Dev Dashboard.
—YesUsed with the client ID to request access tokens for stores in your own organization—
Dev Dashboard access token—YesScopes granted to the appAbout 24 hours (`expires_in` 86399 seconds)

How to create a Shopify key

  1. In the Shopify admin go to Apps then Develop apps and open your custom app.
  2. Open API credentials and generate the Admin API access token.
  3. Copy the token immediately; it is not shown again.

Limiting what the key can do

Staff or collaborators with the required permissions can change an app's API scopes.

How to rotate a Shopify key

  1. In the Dev Dashboard, click Apps, select your app and click Settings.
  2. In the Credentials section, click Rotate next to the client secret, then Generate new secret. The old secret stays active until you revoke it.
  3. Update webhook validation to accept signatures from both secrets, and switch your app's OAuth calls to the new secret.
  4. Replace every stored access token minted under the old secret (client credentials tokens by requesting a new one, offline tokens by refreshing or re-pinning them).
  5. Revoke the old secret in the Dev Dashboard, then validate webhooks with the new secret only.

These steps apply to Dev Dashboard apps. Admin-created custom apps cannot rotate their secret; uninstalling and reinstalling the app gives a new token and disrupts requests and webhooks until your code uses it. If a secret is being actively misused, Shopify says to revoke it immediately and accept the downtime.

How to revoke a Shopify key

  1. Uninstall the custom app, which invalidates its token.

If your Shopify key leaked

  1. Uninstall and reinstall the custom app to obtain a new token.
  2. Update all deployments with the new token.
  3. Do not delete the app, because deletion is permanent and you cannot create a new admin-created custom app.

Things that catch people out

  • Send the token in the X-Shopify-Access-Token header, never the client ID or secret.
  • Dev Dashboard tokens expire in about 24 hours, so cache and refresh them.
  • Deleting an admin-created custom app is permanent and cannot be undone.

Common Shopify authentication errors

shop_not_permitted

With the Dev Dashboard client credentials grant, the app and the store are not in the same Shopify organization.

Using your Shopify key with AI agents

A coding agent that can read your .env file or your shell history can read the key, and anything in its context can end up in logs, transcripts or a prompt-injected request. The safer pattern is to keep the key in a credential broker that performs the authenticated step for the agent and hands back only the result.

BotPassword works this way. For a Shopify key, these intents fit:

IntentWhat BotPassword does
run_withRuns a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output.
http_requestMakes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused.
store_secretSaves a value the agent already holds as a new vault item.

Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents

Frequently asked questions

How do I get a Shopify Admin API access token?

For an existing custom app, open Apps → Develop apps → your app → API credentials. New apps use the Dev Dashboard client credentials grant.

Can I view a Shopify Admin API token again?

No. It is shown only when generated; if lost, generate a new one from API credentials.

How long do Shopify Dev Dashboard tokens last?

About 24 hours; request a new token with grant_type=client_credentials to https://{SHOP}.myshopify.com/admin/oauth/access_token.

Can an AI agent use my Shopify key without seeing it?

Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a .env file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with run_with, http_request, store_secret, so the agent gets the result and never the value.

Stop pasting Shopify keys into agents

BotPassword is in early access. Request an invite and we'll email you when your spot opens.