When you finish, you have an API token and a new lock that is live at checkout.
You need a store on a paid plan or in its 14-day trial. Every request goes to https://app.shopbird.app/api/v1.
Create a token
- In Shopbird, open Settings > API access.
- Create a token. Give it a name and the scopes
locks:readandlocks:write. - Copy the token. It starts with
sb_live_, and Shopbird shows it only once.
List your locks
Send the token in the Authorization header.
curl https://app.shopbird.app/api/v1/locks \
-H "Authorization: Bearer sb_live_…"
import { Shopbird } from "@shopbird/sdk";
const shopbird = new Shopbird({ token: process.env.SHOPBIRD_TOKEN });
const { data, next_cursor } = await shopbird.locks.list();
You see your locks, newest first:
{
"data": [
{ "id": "…", "name": "VIP collection", "enabled": true, "version": 3 }
],
"next_cursor": null
}
Create a lock
Lock one product. Add ?wait=true so the response waits until checkout enforces the lock.
curl -X POST "https://app.shopbird.app/api/v1/locks?wait=true" \
-H "Authorization: Bearer sb_live_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: quickstart-lock-1" \
-d '{
"name": "Moon ring early access",
"targets": [{ "type": "product", "resource_id": "gid://shopify/Product/123" }],
"audience_ids": ["<audience id>"]
}'
const lock = await shopbird.locks.create(
{
name: "Moon ring early access",
targets: [{ type: "product", resource_id: "gid://shopify/Product/123" }],
audience_ids: ["<audience id>"],
},
{ wait: true, idempotencyKey: "quickstart-lock-1" },
);
You get 201 and the new lock. "status": "synced" means checkout enforces it now.
{
"id": "…",
"name": "Moon ring early access",
"enabled": true,
"targets": [{ "type": "product", "resource_id": "gid://shopify/Product/123", "title": "" }],
"audience_ids": ["<audience id>"],
"version": 1,
"sync": { "generation": 42, "status": "synced" }
}
If status is "pending", the lock is saved and Shopbird keeps syncing it. See Changes and checkout.