Skip to main content
Every Swish API request requires a Bearer token in the Authorization header. Swish supports two token types depending on where the request originates.

API keys

Use an API key for server-side requests where the token can be kept secret. To request an API key, contact support@swish.app.
API keys grant full access to your store’s Swish data. Never expose them in client-side code, public repositories, or browser requests.

Client tokens

Use client tokens for browser-side requests. A client token is a short-lived JWT scoped to a single customer or anonymous session. Your server obtains one by calling POST /profiles/token with your API key, then passes it to the client.

Token creation flow

1

Server requests a token

Your server calls POST /profiles/token with the customer’s Shopify GID. For anonymous visitors, omit the customer field to create a session token.
The response includes the token and the associated profile:
2

Client uses the token

Pass the token to the client and use it for subsequent API requests.

Auth proxy

On Shopify themes, the Swish app proxy handles token creation automatically. Headless storefronts (Hydrogen, Next.js, or custom frontends) need to run their own auth proxy using the @swishapp/auth-proxy package. The auth proxy stores your API key server-side and creates scoped client tokens on behalf of your customers. Your storefront calls the proxy to obtain a token, then uses that token directly against the Swish API for all subsequent requests.
See the auth proxy guide for full setup instructions with Hydrogen, Next.js, and custom frameworks.