Skip to content

Agent API for bookings and orders

Let your custom chatbot or your own system check services, book appointments and take shop orders in SaleFlowPoint.

API version 1 · Documentation updated November 24, 2026

On this page

Getting started

Base address: https://saleflowpoint.com/api/v1/agent-api

Use the same API key as the WhatsApp API: make one in WhatsApp › API and webhooks and send it as Authorization: Bearer sfp_live_…. Keep it on your server or in a Connection of your custom chatbot, never in a browser or app. A key without limits can use every WhatsApp API and agent API call. You can limit a key to scopes (agent:bookings for services, staff, slots and bookings; agent:orders for products and orders; agent:invoices; agent:payments; agent:purchases; agent:returns; /branches works with any agent scope), give it an expiry date and an IP allowlist: see key limits. Outside its scopes or allowlist a key answers 403, after its expiry date 401.

Bookings need the Appointments module switched on (otherwise 404). Money is in minor units: 4500 is $45.00. Times are ISO 8601; time on a slot is written for the customer, in the business's own time zone.

curl
curl https://saleflowpoint.com/api/v1/agent-api/services \
  -H "Authorization: Bearer sfp_live_..."

The customer's phone

Every booking and order belongs to a customer_phone in E.164 form (+15035550123). The API trusts the phone you send, because the key is your own: it shows and changes only that phone's bookings and orders, and another phone's id answers 404.

So the phone must come from the WhatsApp number that is writing, never from what the AI says. In a custom chatbot (Mode 3) this is enforced for you: importing this API fills every customer_phone input from the customer's phone (start.customer_phone, locked), saving or building a URL to this API with a phone the AI fills is refused, and when it runs the sender's own phone is always sent, so the model cannot pick another customer's number. In your own system, take it from the incoming message's contact.wa_id with a + in front.

Endpoints

MethodPathWhat it does
GET/branchesOpen branches.
GET/servicesBookable services, with price and length.
GET/staffPeople a customer may choose, when the business allows it.
GET/slotsFree start times for a service on a day.
POST/bookingsBook an appointment.
GET/bookingsA customer's upcoming bookings.
POST/bookings/{id}/rescheduleMove one of the customer's bookings.
POST/bookings/{id}/cancelCancel one of the customer's bookings.
GET/productsProducts shown on the website, with price and stock.
POST/ordersPlace an order (a draft the shop confirms).
GET/ordersA customer's recent orders.
GET/orders/{ref}One order, by id or SO- reference.
GET/invoicesA customer's open invoices, balance and due dates.
GET/invoices/{ref}One invoice with its lines.
GET/paymentsPayments received from a customer.
GET/purchases/{ref}One sale: date, days since and items (warranty check).
POST/return-requestsAsk the shop for a return (nothing is refunded).

Bookings

GET /branches

Open branches: id and name. Most calls take an optional branch_id; it can be left out only when the business has one open branch (several answer 422).

GET /services

Active services. price_minor is null when the website hides prices. Every *_minor amount (whole cents: 9000 = 90.00) also comes as a display string without the _minor (price: "90.00") with the currency code; quote the display string to customers.

200
[
  { "id": "0193c2a1-5b7e-7c10-9d2e-4f1a2b3c4d5e", "name": "Teeth cleaning",
    "description": "Scale and polish, 30 minutes", "price_minor": 9000, "duration_minutes": 30,
    "price": "90.00", "currency": "USD" }
]

GET /staff

FieldTypeRequiredDescription
service_idstringYesFrom /services.
branch_idstringYesFrom /branches.

Answers ref and name; an empty list when the business does not let customers choose who serves them.

GET /slots

FieldTypeRequiredDescription
service_idstringYesFrom /services.
datedateYesThe day, e.g. 2026-12-02.
branch_idstringNoNeeded when the business has several branches.
staff_refstringNoOnly this person's free times.
200
[
  { "starts_at": "2026-12-02T15:00:00+00:00", "ends_at": "2026-12-02T15:30:00+00:00", "time": "Wed 2 Dec 2026, 7:00 AM (America/Los Angeles time)" }
]

POST /bookings

FieldTypeRequiredDescription
customer_phonestringYesE.164; from the WhatsApp number (see above).
customer_namestringYesUp to 160 characters.
customer_emailstringNoConfirmation emails are sent only when given.
service_idstringYesFrom /services.
starts_atdatetimeYesA starts_at from /slots.
branch_idstringNoNeeded when the business has several branches.
staff_refstringNoFrom /staff; otherwise someone free is picked.
notesstringNoUp to 500 characters.
curl -X POST https://saleflowpoint.com/api/v1/agent-api/bookings \
  -H "Authorization: Bearer sfp_live_..." \
  -H "Idempotency-Key: chat-7f3a-book-1" \
  -H "Content-Type: application/json" \
  -d '{"customer_phone":"+15035550123","customer_name":"Emily Carter",
       "service_id":"0193c2a1-5b7e-7c10-9d2e-4f1a2b3c4d5e","starts_at":"2026-12-02T15:00:00Z"}'

starts_at and ends_at are UTC; starts_at_local/ends_at_local are the same moments in the business's time zone with its offset, and time is the text to show the customer.

The booking is checked against every other booking the same way as staff and website bookings, so a time taken meanwhile answers 409. At most 4 bookings per customer per day. Staff see it in Appointments as usual.

GET /bookings?customer_phone=

That phone's upcoming bookings, in the same shape.

POST /bookings/{id}/reschedule

FieldTypeRequiredDescription
customer_phonestringYesMust be the booking's own customer.
starts_atdatetimeYesA new free time from /slots.

POST /bookings/{id}/cancel

FieldTypeRequiredDescription
customer_phonestringYesMust be the booking's own customer.
reasonstringNoUp to 300 characters.

Both answer the booking; a booking already completed or cancelled answers 409.

Products and orders

GET /products

FieldTypeRequiredDescription
searchstringNoPart of the name.
branch_idstringNoStock at this branch; all branches added up when left out.
limitintegerNo1 to 50, default 20.

Only active products shown on the website, at the price the website shows. stock_count is on hand less reserved, or null when the shop does not count stock for the item.

200
[
  { "item_id": "0193c3b0-...", "product_id": "0193c3af-...", "name": "Sourdough Loaf",
    "price_minor": 650, "price": "6.50", "currency": "USD", "stock_count": 14, "in_stock": true }
]

POST /orders

FieldTypeRequiredDescription
customer_phonestringYesE.164; from the WhatsApp number (see above).
customer_namestringYesUp to 160 characters.
customer_emailstringNoOptional.
itemsarrayYes1 to 30 of { item_id, quantity }; whole quantities 1 to 999.
fulfilmentstringDependsdelivery or pickup; needed when the shop offers both.
addressstringDependsNeeded for delivery.
branch_idstringNoNeeded when the business has several branches.
notesstringNoUp to 300 characters.
curl -X POST https://saleflowpoint.com/api/v1/agent-api/orders \
  -H "Authorization: Bearer sfp_live_..." \
  -H "Idempotency-Key: chat-7f3a-order-1" \
  -H "Content-Type: application/json" \
  -d '{"customer_phone":"+15035550123","customer_name":"Emily Carter",
       "items":[{"item_id":"0193c3b0-...","quantity":2}],
       "fulfilment":"delivery","address":"418 Maple Street, Portland, OR 97205"}'

The order is a draft until the shop confirms it in Sales orders; then it gets its SO- reference and the stock is reserved. Delivery, pickup, the delivery fee and the minimum order follow the shop's WhatsApp ordering settings. A counted item without enough stock at the branch answers 409, and so does an order from a shop that hides prices online.

No payment link: payment_link is always null. The customer pays the shop directly: cash on delivery or at pickup, or as the shop arranges.

GET /orders?customer_phone=

That phone's recent orders, in the same shape as the order above (delivery_fee_minor is 0 when there is none; total_minor is the items only; total_with_delivery_minor and total_with_delivery are what the customer pays, items plus the delivery fee). status is draft (waiting for the shop), confirmed, partially_delivered, delivered, invoiced or cancelled.

GET /orders/{ref}?customer_phone=

One order by its id or its SO- reference; another customer's order answers 404.

Invoices and payments

Read-only. Invoices are the customer's account invoices (sales-order and custom invoices, and till sales charged to account); plain paid till sales are not invoices.

GET /invoices?customer_phone=

That phone's open invoices (not fully paid), oldest first, and the total still owed.

200
{ "invoices": [
    { "id": "0193c5a0-...", "number": "INV-1042", "invoice_date": "2026-10-28T16:20:00+00:00",
      "due_date": "2026-11-27T00:00:00+00:00", "days_overdue": 0, "status": "completed",
      "payment_status": "partially_paid", "total_minor": 48000, "paid_minor": 12000,
      "balance_minor": 36000, "total": "480.00", "paid": "120.00", "balance": "360.00",
      "currency": "USD", "lines": null } ],
  "total_balance_minor": 36000, "total_balance": "360.00", "currency": "USD" }

GET /invoices/{ref}?customer_phone=

One of that phone's invoices by id or number, paid ones too, with its lines (name, quantity, unit_price, line_total). Another customer's invoice answers 404.

GET /payments?customer_phone=

That phone's last 20 payments received on account, newest first: received_at, method, amount, and applied_to (which invoices each payment paid, and how much).

Purchases and returns

GET /purchases/{ref}?customer_phone=

For a warranty check: one of that phone's sales by receipt number or id, with purchased_at, days_since_purchase and the items (with returned_quantity). SaleFlowPoint keeps no warranty terms per product, so put your warranty and returns policy in the chatbot's knowledge and let it compare.

POST /return-requests

FieldTypeRequiredDescription
customer_phonestringYesMust be the sale's own customer.
sale_refstringYesThe receipt number or sale id.
reasonstringYesUp to 500 characters.
item_idsarrayNoUp to 30 item_id values from that sale's lines.
201
{ "id": "0193c6b2-...", "status": "requested", "sale_id": "0193c5f1-...",
  "sale_number": "R-2087", "created_at": "2026-11-24T18:02:11+00:00",
  "note": "Request sent to the shop. Nothing has been refunded yet; the shop will contact the customer." }

A request, not a return: nothing is refunded and no stock moves. The shop gets a notification and, if it agrees, does the return at the till as usual. Ask the customer to confirm before sending it.

Safe retries

POST /bookings, POST /orders and POST /return-requests take an optional Idempotency-Key header (up to 80 characters). Sending the same key and body again answers the first result instead of booking or ordering twice; the same key with a different body answers 409. Keys are kept 7 days.

Two-minute duplicate window. Even with a new Idempotency-Key (or none), a second POST /orders for the same customer phone, branch, cart (the same items and quantities) and fulfilment (pickup or delivery, the same address and the same customer note) within 2 minutes answers the first order instead of making a second. The same holds for a second POST /bookings for the same customer phone, service, branch and start time. So a chatbot that sends the same request twice never books or orders twice; a real second order of the same cart can be sent after 2 minutes.

Bookings and orders for one customer phone run one at a time. If another one for the same phone is still being saved, the API answers 503 with the code busy_try_again: wait a moment and send the same request again (with the same Idempotency-Key).

Errors and limits

Errors look like {"error": {"code": "conflict", "message": "…", "correlation_id": "…"}}. The message is written so a chatbot can pass it on to the customer. Quote the correlation_id when you contact us.

StatusWhen
401The key is missing, unknown or revoked, or WhatsApp is not available for the account.
404The branch, service, item, booking or order is not found or belongs to another phone; Appointments is switched off.
409The time was taken, 4 bookings that day, a booking that cannot change, not enough stock, below the minimum order, prices hidden, an archived customer, or an Idempotency-Key reused.
422A field is missing or not valid, e.g. a phone not in E.164 form or a quantity that is not whole.
429More than 300 requests per minute on one key (shared with the WhatsApp API); wait for the seconds in Retry-After.
503Busy (busy_try_again): another booking or order for the same customer phone is still being saved. Retry after a moment with the same Idempotency-Key.

Successful answers carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset.

OpenAPI file

https://saleflowpoint.com/api/v1/agent-api/openapi.json describes every call above as OpenAPI 3. Import it into Postman, or into a custom chatbot's URLs (WhatsApp › URLs › Import). It needs no key.

Build your own agent

Start with the WhatsApp API docs, then connect bookings and orders here.

Loading SaleFlowPoint…