> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# Authentication and Keys

**Published**: 2026-11-30
**Category**: Getting Started

> Lynkow uses five identifiers and credentials. This page says what each one unlocks, where you find it in the dashboard, how to send it, and which ones must stay secret. Previous: [Which API Should I Use?](/sdk/getting-started/which-api) | Next: [Errors](/sdk/getting-started/api-errors)

> **Reference** - This guide is a tutorial. For exhaustive, always-current signatures and field lists, see the auto-generated reference:
> 
> - API: [Storefront: Site Access & Spam Protection](/storefront-api/storefront-site-access) and [Admin API Authentication](/admin-api/api-authentication)
> - SDK: [SDK Types](/sdk/types)

## Prerequisites

- A Lynkow site ([Quick Start](/sdk/getting-started/quick-start), "Use your own site")
- Access to **Settings > Developers** in the dashboard

## Summary

| Credential | Looks like | Where to find it | Secret | How to send it |
| --- | --- | --- | --- | --- |
| Site ID | A UUID | **Settings > Developers > Storefront**, **Site ID** | No | In the URL: `/storefront/{siteId}/...` |
| Publishable key | `lkw_pk_...` | **Settings > Developers > Storefront**, **Storefront keys** | No | `X-Lynkow-Pk` header |
| Server key | `lkw_srv_...` | **Settings > Developers > Storefront**, **Server keys** | Yes | `X-Lynkow-Server-Key` header, with `X-Lynkow-Client-Ip` |
| API token | `lkw_sk_...` | **Settings > Developers > API** | Yes | `Authorization: Bearer` header on `/v1` |
| Customer token | Returned when a buyer signs in | Your app receives it from the API | Yes, it belongs to one buyer | `Authorization: Bearer` header on buyer routes |


The SDK takes the first four in `createClient()` and sets the customer token for you after a sign-in.

## Site ID

The Site ID names your site in every Storefront API request. It is not a secret: it appears in every URL your site calls. Content, pages, search, forms and reviews need nothing else:

```typescript
import { createClient } from 'lynkow'

export const lynkow = createClient({
  siteId: process.env.NEXT_PUBLIC_LYNKOW_SITE_ID!,
})
```

A Site ID that is not a UUID returns 400 `TENANT_SITE_ID_INVALID`, and an unknown one returns 404 `TENANT_SITE_NOT_FOUND`.

## Publishable key

The publishable key identifies your storefront app. The shop routes require it: products, collections, categories, markets, the cart, checkout and buyer accounts. Other routes accept it and do not need it. It is safe in browser code:

```typescript
export const lynkow = createClient({
  siteId: process.env.NEXT_PUBLIC_LYNKOW_SITE_ID!,
  publishableKey: process.env.NEXT_PUBLIC_LYNKOW_PUBLISHABLE_KEY,
})
```

Create one with **New key** under **Storefront keys**. A shop route without a key returns 401 `STOREFRONT_KEY_REQUIRED`, and with a revoked key 401 `STOREFRONT_KEY_REVOKED`.

## Server key

The server key is for a server that calls the Storefront API on behalf of buyers, such as a Next.js Server Action. It vouches for the buyer's IP address your server forwards, so rate limits count each buyer instead of your server. It reads and changes nothing on its own.

Keep it in your server's environment, never in a `NEXT_PUBLIC_` variable: the SDK throws when `serverKey` is set in a browser. [Server Key and Buyer IP](/sdk/advanced/server-key-buyer-ip) covers the setup.

## API token

An API token authenticates the Admin API, under `/v1`:

```bash
curl "https://api.lynkow.com/v1/contents" \
  -H "Authorization: Bearer $LYNKOW_API_TOKEN"
```

Create one under **Settings > Developers > API** with **New token**. The dashboard shows the token once: copy it then. Each token has its own permissions, such as `contents.view` or `products.update`. Give a token only the permissions its job needs, and an expiration date when the job is temporary.

| Status and code | Meaning |
| --- | --- |
| 401 `AUTH_TOKEN_REQUIRED` | No `Authorization: Bearer` header |
| 401 `AUTH_TOKEN_INVALID` | The token is unknown, deleted or regenerated |
| 401 `AUTH_TOKEN_EXPIRED` | The token passed its expiration date |
| 403 `AUTHZ_INSUFFICIENT_PERMISSIONS` | The token lacks a permission the route needs. The message names it |


A site token acts on its own site. An organization token, which can reach several sites, names the site in the `X-Site-Id` header.

An API token can change your site's data. Use it from your server only, and never commit it.

## Customer token

When a buyer signs in, the API returns a session token for that buyer. Buyer routes, such as the account page and its orders, take it in `Authorization: Bearer`, together with the publishable key:

```typescript
const { customer, token } = await lynkow.customers.login({
  email: 'buyer@example.com',
  password: 'their-password',
})
```

The SDK sends the token on the next buyer calls of the same client. It does not store it: keep it yourself, for example in an HttpOnly cookie, and pass it back as `customerToken` in `createClient()`. A missing or invalid token on a buyer route returns 401 `CUSTOMER_AUTH_REQUIRED`. [Customer Accounts](/sdk/features/commerce-customer-accounts) covers sign-up, sign-in and sessions.

## What is secret

| Safe in browser code | Server only |
| --- | --- |
| Site ID, publishable key | Server key, API token |


A customer token belongs to one buyer: keep it in that buyer's session, never in shared code or logs. If a secret leaks, regenerate or revoke it on the page where you created it.

## Reference

- API: [Storefront: Site Access & Spam Protection](/storefront-api/storefront-site-access), [Admin API Authentication](/admin-api/api-authentication)
- SDK: [`CustomersService`](/sdk/services/sdk-customers-service), [SDK Types](/sdk/types)

## Next Steps

- [Errors](/sdk/getting-started/api-errors) - the error body, the status codes and the SDK's `LynkowError`
- [Server Key and Buyer IP](/sdk/advanced/server-key-buyer-ip) - forward each buyer's IP from your server
- [Customer Accounts](/sdk/features/commerce-customer-accounts) - buyer sign-up, sign-in and sessions