# Authentication

Authenticate Store API calls with an app or Store Admin bearer token.

> Send `Authorization: Bearer YOUR_STORE_API_TOKEN` with each authenticated request. `GET /api/2025-01/scopes` is public and does not need a token.

Store API authentication is Bearer-only. Cookies, HTTP Basic authentication, and API keys in query parameters are not accepted.

```http
GET /api/2025-01/reference/currencies HTTP/1.1
Host: api-store.tringify.com
Authorization: Bearer YOUR_STORE_API_TOKEN
```

**Which token to use.** For a first test, a script or a private integration, the store owner creates a Store Admin token (`tsat_`). A public app receives an installation token (`tpat_`) when a merchant installs it, and its screens inside Store Admin use short-lived session tokens (`tast_`). Check any token with [`GET /discover`](/store-api/discover), which shows its store and scopes.

## Token types

| Prefix | Issued by | Lifetime | Access |
| --- | --- | --- | --- |
| `tpat_` | App installation | Until the app is uninstalled or the token is replaced | The scopes the merchant approved for the installation. |
| `tast_` | App Bridge session exchange | 15 minutes | The scopes requested and granted during the session exchange, limited by the installation and the screen that asked. Sessions opened by a staff member are also limited by that staff member's permissions. |
| `tsat_` | Store Admin | Until expiry, rotation, or revocation | The scopes selected for the token. Only the store owner creates these tokens. |

## Getting a token

### App tokens (`tpat_`)

An app receives its token when a merchant installs it. The merchant reviews and approves the scopes requested by the app release they install. Tringify then creates the installation's `tpat_` token and sends it to your app's webhook endpoint in the `app.installed` event, as `data.access_token`, together with the granted `data.scopes` and the `store_id`.

- Set the webhook endpoint and signing key in the Developer Portal under your app's **Webhooks** settings, then publish a release: a store's install, token rotation and uninstall events go to the endpoint of the release it installed, and a later change reaches a store once it installs a newer release. These events are always sent.
- Verify the request signature, then store the token on your server, keyed by `store_id`. The token is not shown in Store Admin and cannot be retrieved later.
- When the merchant approves changed scopes or the token is rotated, `app.token_rotated` delivers a replacement token. Start using it and discard the previous one.
- When the merchant uninstalls the app, `app.uninstalled` is sent and the token stops working.

See [App webhooks](/apps/apps/webhooks) for the payloads and signature verification, and [Install lifecycle](/apps/apps/install-lifecycle) for what uninstalling changes.

### Session tokens (`tast_`)

An embedded app running inside Store Admin calls `bridge.getSessionToken()` to get a short-lived `tast_` token for the scopes one screen needs; see [App Bridge authentication](/apps/admin-app-bridge/authentication). Request another token when one expires, and never store it.

### Store Admin tokens (`tsat_`)

The store owner creates Store Admin tokens in Store Admin under **Settings > API Tokens** for scripts and private server integrations. Select only the scopes the integration needs. Copy the token when it is shown; it cannot be revealed again later.

## Scopes

Each endpoint names its required scope. A write scope includes the read scope the scope catalog lists for it, usually the matching one: `write_products` includes `read_products`. [Scopes and staff permissions](/store-api/getting-started/scopes) lists the Store Admin staff permission that covers each scope. Use `GET /api/2025-01/scopes` to read the current catalog shown during app installation.

Store API scopes use an underscore, such as `read_products` or `write_orders`.

An app that needs additional scopes must request them in a new release, which the merchant approves. Store Admin tokens keep the scopes selected by the merchant until they are updated, rotated, or revoked.

## Token lifecycle

- `tpat_` and `tast_` stop working when the app is uninstalled or the app itself is no longer active. Reducing the installation's approved scopes also reduces the scopes existing tokens can use.
- `tast_` expires 15 minutes after it is issued, and stops working at once if the person who opened the app is no longer a member of the store. Request a new session token through App Bridge.
- `tsat_` stops working at its optional expiry, at most one year after creation, or immediately after rotation or revocation. It acts with the authority of the store owner who created it, so it is also revoked automatically when store ownership is transferred; the new owner is notified and the activity log lists the revoked tokens.

## Authentication errors

| Status | Code | Meaning |
| --- | --- | --- |
| 401 | `UNAUTHORIZED` | The Authorization header is missing. |
| 401 | `INVALID_TOKEN` | The Authorization header is not `Bearer` followed by a token, or the token is not in the form Tringify issues, for example because it is truncated, mistyped or has another prefix than `tpat_`, `tast_` or `tsat_`. |
| 401 | `TOKEN_NOT_ACCEPTED` | The token was not accepted, whatever its type; see below. |
| 403 | `STORE_SUSPENDED` | Tringify has suspended the store. Every request is refused until it is reinstated; your app receives `app.store_suspended` and `app.store_reinstated`. |
| 403 | `STORE_TERMINATED` | Tringify has terminated the store permanently. Every request is refused; your app receives `app.store_terminated`. |
| 402 | `SUBSCRIPTION_REQUIRED` | The store does not have an active or trialing subscription. |
| 403 | `STORE_API_SCOPE_REQUIRED` | The token does not grant the scope required by the endpoint. |
| 403 | `API_VERSION_UNSUPPORTED` | The token is pinned to an API version that is no longer served. |
| 429 | `RATE_LIMITED` | The rate limit was reached, or this IP address sent too many tokens that were not accepted and is paused for a while, whatever token it sends. Wait for `Retry-After` before retrying. |
| 503 | `SERVICE_UNAVAILABLE` | The token could not be checked right now. Retry with backoff; this never means the token is invalid. |

### When a token is not accepted

`TOKEN_NOT_ACCEPTED` is returned for app, session, and Store Admin tokens alike. The response does not say why a token was refused, so a guessed or leaked token reveals nothing. It is returned when:

- an app token (`tpat_`) was replaced by rotation, the app was uninstalled or is no longer active, or its installation has not finished;
- a session token (`tast_`) is more than 15 minutes old, its app installation has ended, or the person it acts for is no longer a member of the store;
- a Store Admin token (`tsat_`) has expired, was rotated, or was revoked, including automatically when store ownership was transferred, its creator no longer has access to the store, or its scopes were narrowed until none remain;
- the store is a transfer store whose build period has ended;
- the token does not exist.

Do not retry the same token. For `tast_`, request a new session token. For `tpat_`, use the replacement from `app.token_rotated`, or treat the installation as ended after `app.uninstalled`. For `tsat_`, ask the merchant to create a new token.

Branch on `error.code`, not `error.message`. See [Errors](/store-api/getting-started/errors) for the common response format and [Rate limits](/store-api/getting-started/rate-limits) for request limits.

## Manage merchant-created tokens

Only the store owner can view, create, change the scopes of, rotate and revoke Store API tokens, under Settings > API Tokens in Store Admin. There is no Store API or MCP endpoint for managing tokens, and every change is recorded in the store's activity log with the person who made it. Choose a descriptive name, at least one scope, a supported API version and an expiry of at most one year (every token expires). The full tsat_ secret is returned once; it cannot be retrieved from the token list or details later. Store it on your server and send it only as Authorization: Bearer. Do not embed it in a storefront, mobile client, URL, repository or log.

Changing scopes changes the access available to subsequent requests using the same secret. If a scope is removed, requests that need it return 403 STORE_API_SCOPE_REQUIRED. Ask the merchant to review the required access rather than repeatedly retrying the refused operation.

Rotation replaces the secret and immediately invalidates the old one. It preserves the token’s scopes, pinned API version and expiry. Rotation does not renew or extend expiry. Revocation also invalidates the token. After either action, an integration using the old secret receives 401 TOKEN_NOT_ACCEPTED.

To change expiry or API version, create a replacement token, update your integration, verify a request, and revoke the previous token. A separate replacement allows a controlled overlap; rotation does not. Send requests to the Store API version the token is pinned to and check the X-Tringify-API-Version response header.

The management pages support search, pagination, details, scope edits, single-token revocation and revocation of selected rows. A one-time secret remains only in the current view; leaving or reloading it does not reveal it again. If an issued secret is lost, create a replacement and revoke the unused token. The token count and limits are shown in the management page.

