{"openapi":"3.1.0","info":{"title":"The Seattle Craftsman booking API","version":"1.0.0","description":"Check availability, get an exact price, and start a booking. Stays are at least 30 nights. Checkout returns a Stripe link that the guest opens to pay; nothing is charged by the API itself."},"servers":[{"url":"https://www.theseattlecraftsman.com"}],"paths":{"/api/availability":{"get":{"operationId":"getAvailability","summary":"Blocked nights, booking rules and price","responses":{"200":{"description":"Availability","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Availability"}}}}}}},"/api/quote":{"post":{"operationId":"getQuote","summary":"Exact price and payment schedule for a stay","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Stay"}}}},"responses":{"200":{"description":"A quote (ok=true) or the reason the dates can't be booked (ok=false)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}}}}},"/api/checkout":{"post":{"operationId":"startCheckout","summary":"Hold the dates for 30 minutes and get a Stripe Checkout link for the guest","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Stay"}}}},"responses":{"200":{"description":"Checkout started","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"booking_id":{"type":"string"},"url":{"type":"string","format":"uri","description":"Stripe Checkout page; the guest opens it to pay"}}}}}},"409":{"description":"Dates unavailable or being checked out by someone else","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Stay":{"type":"object","required":["check_in","check_out"],"properties":{"check_in":{"type":"string","format":"date"},"check_out":{"type":"string","format":"date"},"email":{"type":"string","format":"email","description":"Optional; prefills checkout"}}},"Availability":{"type":"object","properties":{"ok":{"type":"boolean"},"today":{"type":"string","format":"date"},"rules":{"type":"object","properties":{"min_nights":{"type":"integer"},"max_nights":{"type":"integer"},"min_lead_days":{"type":"integer"},"max_days_ahead":{"type":"integer"}}},"nightly_rate_cents":{"type":"integer"},"monthly_rate_cents":{"type":"integer"},"blocked":{"type":"array","description":"Booked night ranges [start, end); end is a valid check-out day","items":{"type":"array","items":{"type":"string","format":"date"},"minItems":2,"maxItems":2}}}},"Quote":{"type":"object","properties":{"ok":{"type":"boolean"},"nights":{"type":"integer"},"currency":{"type":"string"},"total_cents":{"type":"integer"},"due_today_cents":{"type":"integer"},"periods":{"type":"array","items":{"type":"object","properties":{"start":{"type":"string","format":"date"},"end":{"type":"string","format":"date"},"nights":{"type":"integer"},"amount_cents":{"type":"integer"},"invoice_on":{"type":"string","format":"date"},"due_on":{"type":"string","format":"date"}}}},"error":{"type":"string"},"message":{"type":"string"}}},"Error":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string"},"message":{"type":"string"}}}}}}
