Skip to main content
The Gallery API uses token-based authentication. Each project has its own gallery token and the SDK attaches it automatically via X-Gallery-Token on every request.

Generating a token

1

Open the project in the panel

Navigate to your project and go to Settings → Gallery.
2

Generate a token

Click Generate token.
3

Copy it immediately

The token is shown only once. The panel stores only the SHA-256 hash — there is no way to retrieve the original value later.
If you lose the token, you must revoke it and generate a new one.
A token looks like a 64-character hex string:

Using the token

Pass it to createFramalabClient at initialization: Store both values as environment variables.
.env.local
client.ts
The SDK attaches X-Gallery-Token: <token> to every request automatically.

Storing the token

Treat gallery tokens like API keys — do not commit them to source control.
As long as data fetching happens server-side (Server Components, SSG, SSR), the token never reaches the browser.

Token lifecycle

Error when the token is invalid

HTTP 401. See Error Handling for how to catch this in code.