Every Storefront API request names your site by its ID in the URL. Commerce routes also require your publishable key, and customer account routes require a customer session token.

Site identification

The site ID is the first path segment after /storefront:

http
GET https://api.lynkow.com/storefront/{siteId}/contents

The admin shows your site ID under Settings > Developers > Storefront, and on the last screen of site creation, under Add your environment variables, as NEXT_PUBLIC_LYNKOW_SITE_ID. GET /v1/site/info returns it as data.id. A site ID that is not a UUID returns 400, and an unknown one returns 404.

Publishable key

Send your publishable key in the X-Lynkow-Pk header. It has the form lkw_pk_ followed by 24 characters. It is not a secret, so it can ship in browser code.

Commerce routes require it: products, product collections and categories, availability and bookings, payments, cart, checkout and customer accounts. Without it they return 401 STOREFRONT_KEY_REQUIRED, and an unknown or revoked key returns 401. Every other route accepts the key and ignores an invalid one.

The key is in the admin under Settings > Developers > Storefront. The admin shows the full key once, when it is created. If you no longer have it, regenerate it there: the previous key stops working at once.

Server key

A server that calls the Storefront API for its buyers, such as a server-rendered store, reaches it from one address, so all its buyers share the per-visitor rate limits. Send the buyer's IP in X-Lynkow-Client-Ip and the site's server key in X-Lynkow-Server-Key to count each buyer on their own.

The server key has the form lkw_srv_ followed by 24 characters. Create it under Settings > Developers > Storefront, where it is shown once. It is a secret: keep it on your server, never in browser code. It only vouches for the buyer IP and grants no other access. A secret API token also works in X-Lynkow-Server-Key. A missing, unknown or revoked key never fails the request: the IP is ignored.

X-Lynkow-Client-Ip holds one IPv4 or IPv6 address, with no port. Read it from a header your proxy or CDN overwrites on every request, never from one the buyer can write. Server Key and Buyer IP lists the limits it affects and how to check it works.

Customer session

POST /customers/login and POST /customers/activation/confirm return a customer session token in data.token. Send it as Authorization: Bearer <token>, together with the publishable key. /customers/me and its addresses and marketing consent, /customers/logout, /customers/resend-verification and /cart/claim require it, and answer 401 CUSTOMER_AUTH_REQUIRED without a valid one. Cart, checkout and booking routes accept it too, and then act for that customer.

Allowed origins

When your site has a domain, the content, page, site, form, review, search and SEO routes check the Origin or Referer header. Commerce, analytics and cookie consent routes do not. A request from another hostname returns 403 DOMAIN_MISMATCH. A form or review submission that carries neither header returns 403 DOMAIN_ORIGIN_REQUIRED, so a server-side caller sends an Origin header naming your domain. A read without them is served.

To allow another hostname, such as a local or staging host, add it under Settings > Developers > Storefront > Allowed origins. Only the hostname is compared: the port and the scheme are ignored.

Spam protection on writes

Form, review, booking, checkout, signup and password reset requests go through the site's spam protection, in one of two modes:

  • Honeypot and timestamp, the default. Leave _hp empty and set _ts to the time the form loaded, in milliseconds. A missing _ts, or one more recent than the site's minimum delay (3 seconds by default), returns 429 RATE_SUBMISSION_TOO_FAST. One older than the maximum (1 hour by default) returns 400 RATE_SUBMISSION_EXPIRED.

  • reCAPTCHA, when the site uses it. Send the token in recaptchaToken. A missing or failed token returns 400.

Read routes have no spam protection.

Caching

Every response carries a Cache-Control header that says whether, and for how long, you may cache it.

Error responses

Status

Meaning

400

Site ID not a UUID, form expired, or reCAPTCHA token missing or failed

401

Publishable key or customer session token missing or invalid where required

403

Origin not allowed, site inactive, customer account or verified email required, no access to this payment, or the feature is not public

404

Site or resource not found

422

Validation error

429

Too many requests, or a form sent too soon