Public read and submission endpoints for storefronts and frontends. Requests carry no API token: the site ID is in the URL path. Commerce and customer account routes also require your publishable key in the X-Lynkow-Pk header, and signed-in customer routes a customer session token. Form, review, booking, checkout, signup and password reset requests go through the site spam protection.
Authentication
Requests carry no API token. The site ID is part of the base URL. Commerce routes also require your publishable key in the X-Lynkow-Pk header, and customer account routes require a customer session token as Authorization: Bearer <token>. Each endpoint page lists what it requires.
Site Access & Spam Protection details both, with the allowed origins and the spam protection on writes.
First request
Read the public configuration of your site. It needs no key.
import { createClient } from 'lynkow'
const lynkow = createClient({ siteId: process.env.LYNKOW_SITE_ID! })
const config = await lynkow.site.getConfig()
console.log(config.enabledLocales) // ['en', 'fr', 'de']
console.log(config.i18n.detection.enabled) // true
console.log(config.analytics.consentMode) // 'opt-in'curl "https://api.lynkow.com/storefront/$LYNKOW_SITE_ID/site"Errors
Every error returns JSON with an errors array and a requestId:
{
"errors": [
{
"message": "The email field must be defined",
"field": "email",
"code": "VALIDATION_REQUIRED"
}
],
"requestId": "8f14e45f-ceea-467f-a8e5-2c0d3a1b6f9e"
}Branch on code: it is stable, while message is written for people and can change. field names the input at fault. Quote requestId when you contact support.
Status | Meaning |
|---|---|
| Malformed request, or a submission refused by spam protection |
| Missing, invalid or revoked publishable key, or no valid customer session ( |
| The request origin is not allowed for the site or the key, or a write on a site whose storefront API is read-only, such as the docs demo site ( |
| Unknown or unpublished resource |
| Validation failed: one entry per invalid field |
| Rate limit exceeded ( |
| Server error, with a generic message |
Rate limits
Requests are counted per minute, per site and per client IP. With a publishable key, they are also counted per key.
Some routes have tighter limits of their own, such as form and review submissions, customer sign-in and the cart.
Past a limit, the API returns 429 RATE_LIMIT_EXCEEDED. Wait, then retry with an exponential backoff. Only the customer sign-in and confirmation backoffs send a Retry-After header.
A successful response carries X-RateLimit-Limit and X-RateLimit-Remaining for one of the limits that apply, so a tighter route limit can refuse a request first.