Beta: the Biskèt Partner API may still change before v1 is final. Sandbox access is by request:partners@bisket.ai.
Idempotency
Every POST requires an Idempotency-Key header (1–255 printable ASCII characters; use a UUID v4)
(400 missing_idempotency_key otherwise). Biskèt keeps the key, a hash of the
request and the answer for 72 hours:
- same key, same request: the first answer is replayed (even an error), with
Idempotent-Replayed: true; - same key, another request:
409 idempotency_conflict; - same key while the first is still running:
409 idempotency_in_progresswithRetry-After: 1.
5xx answers are not stored: a retry with the same key runs again. Orders are also idempotent on external_id: the
same id with the same body returns the existing order, even after 72 hours.
The SDK sends a key on every POST and reuses it on its own retries. To retry across process restarts, pass your own:
// Idempotency: the same Idempotency-Key and the same body replay the first answer.import { createBisket } from '@bisket-ai/partner-sdk';
export async function main(env: { apiKey: string; locationId: string }) { const bisket = createBisket({ apiKey: env.apiKey }); const location_id = env.locationId; const { data: menu } = await bisket.GET('/v1/locations/{location_id}/menu', { params: { path: { location_id } } }); const item = menu!.items.find((i) => i.available && i.variants.length === 0 && i.modifier_groups.length === 0 && i.base_price)!; const amount = item.base_price!.amount; const body = { external_id: `IDEM-${Date.now()}`, partner_order_number: 'IDEM', customer: { first_name: 'Ana' }, items: [{ item_id: item.id, variant_id: null, quantity: 1, unit_price: { amount, currency: 'HTG' as const }, modifiers: [] }], subtotal: { amount, currency: 'HTG' as const }, delivery_fee: { amount: 0, currency: 'HTG' as const }, // required for delivery (0 allowed) collected_by: 'partner' as const, payment: { method: 'card' as const, status: 'paid' as const, amount: { amount, currency: 'HTG' as const } }, }; const key = crypto.randomUUID(); // one key per logical request, reused on retries const first = await bisket.POST('/v1/locations/{location_id}/orders', { params: { path: { location_id }, header: { 'Idempotency-Key': key } }, body }); const again = await bisket.POST('/v1/locations/{location_id}/orders', { params: { path: { location_id }, header: { 'Idempotency-Key': key } }, body }); return { sameOrder: first.data!.id === again.data!.id, replayed: again.response.headers.get('Idempotent-Replayed'), // "true" };}