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), optionalIdempotency-Key. - 201: keep
signupIdandlinkToken;resumeUrllets the customer come back later. - 409
existing_customer: the address is already a customer; showdetails.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 newIdempotency-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 fromdetails.quote, let the customer confirm, then try again with a newIdempotency-Key.
7. Book the first appointment
getAvailability—GET /v1/signup/{signupId}/availability: dates with their morning and afternoon windows. Emptyoptionscomes withroutesFullMessage: show it instead of a calendar. 503fieldroutes_unavailable: offer Retry.scheduleAppointment—PUT /v1/signup/{signupId}/appointmentwith{"date", "slot": "am" | "pm"}. 202, then pollgetSignupStatus.
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.