API recipes: common integrations

Worked examples: sync your catalog to a website, show live stock, look up loyalty, add sign-ups as customers, export sales and take B2B orders.

8 min read Updated Oct 17, 2026

1. Keep a website catalog in sync

Key scopes: catalog.read (+ stock.read for stock). Default store: the store whose prices the website shows.

  1. First load: page through GET /items?per_page=200 and save every item by id.
  2. Every 15 minutes: GET /items?updated_since=<time of your last sync>&include_inactive=true — update changed items and hide ones with is_active: false.
  3. Show image_url, price_cents / 100 and the department.
curl "https://api.leisurenexus.app/v1/items?updated_since=2026-10-17T13:00:00Z&include_inactive=true&per_page=200" \
  -H "Authorization: Bearer lnk_…"

2. Show "in stock" on product pages

GET /stock?item_id[]=<id>&item_id[]=<id> for up to 200 items at once. Cache the answer for a few minutes; use in_stock for the badge and on_hand for "only 3 left".

3. Loyalty lookup in your app

Scope customers.read. When a customer signs in to your app with their phone number:

curl "https://api.leisurenexus.app/v1/customers?phone=5125550199" -H "Authorization: Bearer lnk_…"

Show points_balance. The same phone number works as their loyalty number at the register.

4. Website sign-ups become customers

Scope customers.write. When someone signs up:

  1. GET /customers?email=<their email> — if found, PATCH it.
  2. Otherwise POST /customers with first name, last name, email and phone.
  3. A 422 with fields.phone or fields.email means another customer already has it — look that one up instead.

5. Daily sales export to a data warehouse

Scope orders.read. Every night:

curl "https://api.leisurenexus.app/v1/orders?since=2026-10-16T05:00:00Z&until=2026-10-17T05:00:00Z&per_page=200&sort=completed&dir=asc" \
  -H "Authorization: Bearer lnk_…"

Page until page = pages. Store type (sale or refund) and status (completed or voided) so totals match LeisureNexus reports: count completed sales, subtract refunds, skip voided. Use each store's time zone from GET /locations to choose the day's start and end.

For real-time dashboards, subscribe to order.completed and order.voided webhooks instead of polling.

6. A B2B ordering portal

Scopes catalog.read and orders.write. Needs the Wholesale profile.

  1. Show items from GET /items.
  2. Map each portal account to its LeisureNexus business customer id.
  3. POST /sales-orders with customer_id, their customer_po and the lines (by sku or item_id).
  4. Show the returned order number and total_cents. The order arrives as a draft for your team to confirm.
  5. Subscribe to sales_order.invoiced to email the customer when it's invoiced.

Testing

Create a separate key for testing, point webhooks at a test URL, and use Send test to check your signature code before going live.

Still stuck? Email support@leisurenexus.com or send us a message — we're happy to help.