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

Source: https://botpassword.com/keys/shopify
Last checked: 2026-11-08

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.

## Key types

| Type | Prefix | Secret | Scope | Expiry |
|---|---|---|---|---|
| Admin API access token (custom app) | — | Yes | The Admin API scopes configured on the app | — |
| Dev Dashboard client secret | — | Yes | Used with the client ID to request access tokens for stores in your own organization | — |
| Dev Dashboard access token | — | Yes | Scopes granted to the app | About 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.

## How to revoke a Shopify key

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

## If the 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.

## Gotchas

- 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.

## Using this key with AI agents (BotPassword)

- `run_with`: Runs 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_request`: Makes 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_secret`: Saves a value the agent already holds as a new vault item.

## FAQ

### 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.

## Sources

- https://shopify.dev/docs/apps/build/authentication-authorization/access-tokens/generate-app-access-tokens-admin
- https://shopify.dev/docs/apps/build/dev-dashboard/get-api-access-tokens
- https://shopify.dev/docs/apps/build/authentication-authorization/client-secrets/rotate-revoke-client-credentials
