Skip to navigation

Customer booking flow

How the booking site takes a homeowner from an address to a booked first appointment. Every call below is under https://schedule-api-dev.moxieservices.com (dev) or https://schedule-api.moxieservices.com (prod).

1. Show the catalog for the address

getCatalog — GET /v1/public/catalog?zip=75001

Returns the office serving the ZIP with its plans, add-ons and pests. Add homeSqft to get each plan’s price for that home. 422 zip_not_serviced: stay on the address step and ask for another address.

2. Start the signup

createSignup — POST /v1/signup with the address

  • Headers: CF-Turnstile-Response (Cloudflare Turnstile), optional Idempotency-Key.
  • 201: keep signupId and linkToken; resumeUrl lets the customer come back later.
  • 409 existing_customer: the address is already a customer; show details.callCenterPhone. No signup was created.

3. Save each step

updateSignup — PATCH /v1/signup/{signupId} with X-Link-Token

Send what the step collected: property, contact, pestIds, planId, smsConsent, and the step reached. The server works out the add-ons from the pests and plan. Resume with getSignup.

4. Price it

createQuote — POST /v1/signup/{signupId}/quote

Freezes the prices for 24 hours. 422 names anything missing (property, contact, plan). Optional discount: applyDiscountCode / removeDiscountCode (PUT / DELETE /v1/signup/{signupId}/discount); every refusal is the same 422 discount_not_applicable.

5. Agreement and card

Show the terms from getCurrentTerms (GET /v1/public/terms/current). The card goes into the payment provider’s form, which returns a token; card details never reach the API.

6. Order Complete

completeSignup — POST /v1/signup/{signupId}/complete

  • Headers: X-Link-Token, a new Idempotency-Key, CF-Turnstile-Response.
  • Body: the quote ID, the payment token, the terms version and the signature.
  • 202: poll getSignupStatus (GET /v1/signup/{signupId}/status) about once a second.
  • 409 price_changed, quote_expired, item_unavailable: show old and new totals from details.quote, let the customer confirm, then try again with a new Idempotency-Key.
Status ends inShow
awaiting_appointmentThe appointment step
payment_declinedThe card step again
failedThe reference and a Try again button (error.code says why)

7. Book the first appointment

  1. getAvailability — GET /v1/signup/{signupId}/availability: dates with their morning and afternoon windows. Empty options comes with routesFullMessage: show it instead of a calendar. 503 fieldroutes_unavailable: offer Retry.
  2. scheduleAppointment — PUT /v1/signup/{signupId}/appointment with {"date", "slot": "am" | "pm"}. 202, then poll getSignupStatus.
Status ends inShow
completeThe confirmation page (confirmation, accountNumber, confirmationSentTo)
slot_unavailableThe calendar again
awaiting_appointment with errorThe calendar with the error; let them try again

resendConfirmation (POST /v1/signup/{signupId}/resend-confirmation) resends the email, 3 times an hour.

Errors

Every error has the same shape: code, message, requestId, and fieldErrors for invalid fields. 429 rate_limited: wait and retry. 404 / 410 link_expired: show a start-over screen.