Authentication
Every /v1 request carries a storefront token as a bearer token:
Authorization: Bearer sfpub_…Create a storefront
Section titled “Create a storefront”-
In the Sevigram business app, open Settings → Custom storefronts and create a storefront.
-
Add its allowed origins: every address shoppers, and you, will open the storefront on. For example,
http://localhost:5173for development andhttps://shop.examplefor production. An origin is scheme, host and port only, with no path or trailing slash. A storefront takes up to 20 origins. -
Copy the public token. You can read it again at any time.
-
Optionally, copy the private token. It’s shown once, when the storefront is created or the token is rotated. Store it in a password manager or your host’s secret settings.
Public and private tokens
Section titled “Public and private tokens”| Public token | Private token | |
|---|---|---|
| Prefix | sfpub_ |
sfprv_ |
| Where it runs | Browser or server | Server only |
| Origin check | Requests must come from an allowed origin | None |
| Customer accounts | Not allowed (403 private_token_required) |
Allowed |
| Shown again | Any time | Only when created or rotated |
Public token
Section titled “Public token”The public token is safe in browser code. It only works from the storefront’s allowed origins: a request whose Origin isn’t on the list gets 403 origin_not_allowed.
When you call the API from your own server with the public token, send your storefront’s origin in the Origin header.
Private token
Section titled “Private token”Use the private token only in server code, for server-rendered pages and for customer accounts. Never send it to the browser, and never put it in a client bundle, a commit or a log.
Because every shopper’s request then comes from your server’s IP, send each shopper’s IP so rate limits apply per shopper rather than to your whole site:
X-Sevigram-Buyer-IP: 203.0.113.7A value that isn’t a valid IP address gets 400 invalid_buyer_ip.
Rotate and revoke
Section titled “Rotate and revoke”In Settings → Custom storefronts you can rotate either token:
- Rotate issues a new token, and the old one keeps working for 24 hours, so you can deploy the new one first.
- Revoke stops the old token immediately and issues a replacement. Use it if a token leaks.
A token that’s revoked, mistyped, or was rotated more than 24 hours ago gets 401 invalid_token.
Turned-off storefronts
Section titled “Turned-off storefronts”If the storefront is turned off, the business no longer has custom storefronts, or the business is suspended, every request gets 403 storefront_disabled.
The demo shop
Section titled “The demo shop”A read-only demo shop is available for trying the API and Loom. Its public token works from http://localhost:5173, http://127.0.0.1:5173, http://localhost:3000 and http://127.0.0.1:3000. GET /shop returns read_only: true, and checkout and contact answer 403 demo_shop_read_only. Loom’s scaffolder writes the current demo token for you; see Getting started.