{"openapi":"3.1.0","info":{"title":"GetMyPinkSlip API","version":"0.46.1","description":"API for searching vehicle inspection stations, booking inspections, and managing station listings across Australia."},"servers":[{"url":"http://localhost:3001","description":"Local dev"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Clerk JWT token"},"apiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"System API key for machine-to-machine calls"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"]}},"required":["error"]},"BookingEventItem":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["BOOKED","MOVED","CHECKED_IN","RESULT","NO_SHOW","CANCELLED","BLOCKED","UNBLOCKED"]},"at":{"type":"string","format":"date-time"},"actor":{"type":"object","properties":{"type":{"type":"string","enum":["CUSTOMER","STATION","SUPPORT","SYSTEM"]},"name":{"type":["string","null"],"description":"A station user's first name; null for every other actor, or when the name cannot be read"}},"required":["type","name"]},"data":{"type":["object","null"],"additionalProperties":{},"description":"Per type: BOOKED { channel }, MOVED { from, to } (each { date, timeSlot }), RESULT { result }, CANCELLED { by }, BLOCKED/UNBLOCKED { bays }; null for CHECKED_IN and NO_SHOW. Backfilled rows also carry backfilled: true."}},"required":["id","type","at","actor","data"],"additionalProperties":false},"JobLine":{"type":"object","properties":{"id":{"type":"string"},"jobId":{"type":"string"},"kind":{"type":"string","enum":["INSPECTION","CALLOUT","LABOUR","PART","CONSUMABLE","FEE"]},"catalogueItemId":{"type":["string","null"]},"description":{"type":"string"},"quantity":{"type":"number","description":"Greater than 0, up to 3 decimal places"},"unitPriceDefaultCents":{"type":["integer","null"],"description":"Snapshot taken when the line was added; null on an ad-hoc line"},"unitPriceCents":{"type":["integer","null"],"description":"Price charged, GST-inclusive cents; null only on an unpriced INSPECTION line"},"taxable":{"type":"boolean"},"sortOrder":{"type":"integer"},"lineTotalCents":{"type":["integer","null"],"description":"quantity x unitPriceCents, rounded half away from zero; null when unpriced"},"gstCents":{"type":["integer","null"],"description":"GST within lineTotalCents; null when unpriced"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","jobId","kind","catalogueItemId","description","quantity","unitPriceDefaultCents","unitPriceCents","taxable","sortOrder","lineTotalCents","gstCents","createdAt","updatedAt"],"additionalProperties":false},"Job":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"createdByClerkUserId":{"type":["string","null"]},"bookingIds":{"type":"array","items":{"type":"string"},"description":"Every booking row of the logical booking (all slot rows, any status)"},"gstRegistered":{"type":"boolean"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/JobLine"},"description":"In sortOrder"},"totalCents":{"type":"integer","description":"GST-inclusive"},"gstCents":{"type":"integer"},"hasUnpricedLines":{"type":"boolean","description":"True while any line is unpriced; such a Job cannot be invoiced"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","stationId","createdByClerkUserId","bookingIds","gstRegistered","lines","totalCents","gstCents","hasUnpricedLines","createdAt","updatedAt"],"additionalProperties":false},"SpecialOrderPart":{"type":"object","properties":{"id":{"type":"string"},"jobId":{"type":"string"},"description":{"type":"string"},"supplierName":{"type":"string"},"supplierRef":{"type":["string","null"],"description":"Supplier reference or PO"},"costExCents":{"type":"integer","description":"Supplier cost, ex-GST cents"},"eta":{"type":["string","null"],"format":"date-time"},"status":{"type":"string","enum":["ORDERED","RECEIVED","FITTED","RETURN_PENDING","RETURNED","KEPT_TO_STOCK","WRITTEN_OFF"]},"fittedJobLineId":{"type":["string","null"],"description":"The Job Line the part became when FITTED"},"creditNoteRef":{"type":["string","null"],"description":"The supplier's credit note reference, set when RETURNED"},"resolvedByClerkUserId":{"type":["string","null"],"description":"The signed-in user who resolved the part"},"resolvedByName":{"type":["string","null"],"description":"Resolver display name; null when no resolver or their name is unavailable"},"resolvedAt":{"type":["string","null"],"format":"date-time"},"returnPendingAt":{"type":["string","null"],"format":"date-time","description":"When the part became RETURN_PENDING; the Return pending age counts from it"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","jobId","description","supplierName","supplierRef","costExCents","eta","status","fittedJobLineId","creditNoteRef","resolvedByClerkUserId","resolvedByName","resolvedAt","returnPendingAt","createdAt","updatedAt"],"additionalProperties":false},"ReturnPendingList":{"type":"object","properties":{"suppliers":{"type":"array","items":{"type":"object","properties":{"supplierName":{"type":"string"},"parts":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/SpecialOrderPart"},{"type":"object","properties":{"bookingId":{"type":["string","null"],"description":"The Job's first diary booking; null for a Job without a booking"},"bookingDate":{"type":["string","null"],"format":"date","description":"Current station-local diary date of that booking (YYYY-MM-DD)"},"ageDays":{"type":"integer","description":"Whole days since returnPendingAt"}},"required":["bookingId","bookingDate","ageDays"],"additionalProperties":false}]}},"totalCostExCents":{"type":"integer"}},"required":["supplierName","parts","totalCostExCents"],"additionalProperties":false}},"totalCostExCents":{"type":"integer","description":"Across every supplier"}},"required":["suppliers","totalCostExCents"],"additionalProperties":false},"InvoiceBillTo":{"type":"object","properties":{"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"rego":{"type":["string","null"]},"email":{"type":["string","null"]},"abn":{"type":["string","null"],"description":"The buyer's ABN, if given"}},"required":["name","phone","rego","email","abn"],"additionalProperties":false,"description":"Freetext bill-to snapshot"},"InvoiceBillingProfile":{"type":"object","properties":{"legalName":{"type":"string"},"abn":{"type":["string","null"]},"billingAddress":{"type":"string"},"gstRegistered":{"type":"boolean"},"paymentInstructions":{"type":["string","null"]},"footer":{"type":["string","null"]}},"required":["legalName","abn","billingAddress","gstRegistered","paymentInstructions","footer"],"additionalProperties":false,"description":"The Billing Profile as it was when the invoice was issued"},"InvoiceLine":{"type":"object","properties":{"id":{"type":"string","description":"A Job Line id while the invoice is a DRAFT; an immutable Invoice Line id once issued"},"invoiceId":{"type":"string"},"sourceJobLineId":{"type":["string","null"],"description":"The Job Line this line was copied from"},"creditsInvoiceLineId":{"type":["string","null"],"description":"On a credit note line, the invoice line it credits"},"kind":{"type":"string","enum":["INSPECTION","CALLOUT","LABOUR","PART","CONSUMABLE","FEE"]},"description":{"type":"string"},"quantity":{"type":"number","description":"Negative on a credit note line"},"unitPriceCents":{"type":["integer","null"],"description":"GST-inclusive cents. Null only for an unpriced line on a draft"},"taxable":{"type":"boolean"},"sortOrder":{"type":"integer"},"lineTotalCents":{"type":["integer","null"],"description":"quantity x unitPriceCents, rounded half away from zero. Null only for an unpriced line on a draft"},"gstCents":{"type":["integer","null"],"description":"round_half_up(lineTotalCents / 11) on a taxable line of a GST-registered station, else 0. Null only for an unpriced line on a draft"}},"required":["id","invoiceId","sourceJobLineId","creditsInvoiceLineId","kind","description","quantity","unitPriceCents","taxable","sortOrder","lineTotalCents","gstCents"],"additionalProperties":false},"Invoice":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"jobId":{"type":"string"},"kind":{"type":"string","enum":["INVOICE","CREDIT_NOTE"]},"creditsInvoiceId":{"type":["string","null"],"description":"On a credit note, the invoice it credits"},"status":{"type":"string","enum":["DRAFT","ISSUED"]},"number":{"type":["string","null"],"description":"Assigned from the per-station sequence on issue; null on a draft"},"issuedAt":{"type":["string","null"],"format":"date-time"},"terms":{"type":"string","enum":["DUE_ON_RECEIPT","ACCOUNT"]},"dueDate":{"type":["string","null"],"format":"date","description":"YYYY-MM-DD"},"customerId":{"type":["string","null"]},"billTo":{"allOf":[{"$ref":"#/components/schemas/InvoiceBillTo"},{"description":"Always present; each field may be null. On a draft it is a live preview of the current booking/customer (nothing is stored); the freetext in force at issue is frozen on issue"}]},"billingProfile":{"allOf":[{"$ref":"#/components/schemas/InvoiceBillingProfile"},{"type":["object","null"],"description":"Frozen snapshot once issued. A draft shows the station's current Billing Profile live, or null when it has none yet"}]},"lines":{"type":"array","items":{"$ref":"#/components/schemas/InvoiceLine"},"description":"In sortOrder. A draft reads its Job's live lines"},"totalCents":{"type":"integer","description":"GST-inclusive; negative on a credit note. On a draft, the sum of its priced lines"},"gstCents":{"type":"integer","description":"On a draft, the sum over its priced lines"},"title":{"type":"string","enum":["Tax Invoice","Invoice","Credit Note"],"description":"\"Tax Invoice\" for a GST-registered station, \"Invoice\" otherwise, \"Credit Note\" for a credit note"},"reason":{"type":["string","null"],"maxLength":500,"description":"Why a credit note was issued (trimmed, at most 500 characters), frozen with it; null when none was given and always null on an invoice"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","stationId","jobId","kind","creditsInvoiceId","status","number","issuedAt","terms","dueDate","customerId","billTo","billingProfile","lines","totalCents","gstCents","title","reason","createdAt"],"additionalProperties":false},"InvoicePrintData":{"type":"object","properties":{"paperSize":{"type":"string","enum":["A4"]},"invoice":{"$ref":"#/components/schemas/Invoice"}},"required":["paperSize","invoice"],"additionalProperties":false},"InvoiceSummary":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["INVOICE","CREDIT_NOTE"]},"status":{"type":"string","enum":["DRAFT","ISSUED"]},"number":{"type":["string","null"],"description":"Null on a draft"},"issuedAt":{"type":["string","null"],"format":"date-time","description":"Null on a draft"},"totalCents":{"type":["integer","null"],"description":"GST-inclusive; negative on a credit note; null on a draft"},"gstCents":{"type":["integer","null"],"description":"Null on a draft"},"creditsInvoiceId":{"type":["string","null"],"description":"On a credit note, the invoice it credits"}},"required":["id","kind","status","number","issuedAt","totalCents","gstCents","creditsInvoiceId"],"additionalProperties":false},"InvoiceBalance":{"type":"object","properties":{"invoiceId":{"type":"string"},"totalCents":{"type":"integer","description":"The invoice's GST-inclusive total"},"creditNoteTotalCents":{"type":"integer","description":"Sum of the credit note totals; zero or negative"},"paidCents":{"type":"integer","description":"Sum of recorded PAYMENTs"},"refundedCents":{"type":"integer","description":"Sum of recorded REFUNDs"},"roundingCents":{"type":"integer","description":"Net cash rounding written off: payment rounding minus refund rounding. Applied only on the payment that settles the balance"},"balanceCents":{"type":"integer","description":"What is still owing after credit notes, payments, refunds and cash rounding; zero when settled"},"paymentState":{"type":"string","enum":["UNPAID","PART_PAID","PAID"],"description":"Derived from the balance on every read, never stored"}},"required":["invoiceId","totalCents","creditNoteTotalCents","paidCents","refundedCents","roundingCents","balanceCents","paymentState"],"additionalProperties":false},"RecordedPayment":{"type":"object","properties":{"id":{"type":"string"},"invoiceId":{"type":"string"},"kind":{"type":"string","enum":["PAYMENT","REFUND"]},"method":{"type":"string","enum":["CASH","CARD_EXTERNAL","BANK_TRANSFER"],"description":"Card payments are taken on the station terminal; nothing is processed here"},"amountCents":{"type":"integer","description":"Positive cents, whatever the kind; 0 only in cash, for the PAYMENT settling a 1c or 2c balance or the REFUND of the rounding left once everything paid is refunded"},"reference":{"type":["string","null"]},"tenderedCents":{"type":["integer","null"],"description":"Cash PAYMENT only; null otherwise"},"changeCents":{"type":["integer","null"],"description":"Cash PAYMENT only: tenderedCents minus the amount settled; null otherwise"},"roundingCents":{"type":["integer","null"],"description":"Cash only (null otherwise). On a PAYMENT, the settled amount minus the exact amount owing; on a REFUND, the net rounding it reverses. Non-zero only on the settling cash payment and on the cash refund that returns the last of the money (or, at 0c, the rounding alone)"},"takenByClerkUserId":{"type":"string","description":"The signed-in user who recorded it; never taken from the request"},"takenAt":{"type":"string","format":"date-time"}},"required":["id","invoiceId","kind","method","amountCents","reference","tenderedCents","changeCents","roundingCents","takenByClerkUserId","takenAt"],"additionalProperties":false},"StationCustomerAccountBooking":{"type":"object","properties":{"id":{"type":"string"},"jobId":{"type":["string","null"]},"date":{"type":"string","format":"date","description":"Station-local YYYY-MM-DD"},"status":{"type":"string","enum":["PENDING","CONFIRMED","CHECKED_IN","COMPLETED","CANCELLED","NO_SHOW","RESCHEDULED"]}},"required":["id","jobId","date","status"],"additionalProperties":false},"StationCustomerAccountJob":{"type":"object","properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","createdAt"],"additionalProperties":false},"StationCustomerAccountInvoice":{"type":"object","properties":{"id":{"type":"string"},"jobId":{"type":"string"},"kind":{"type":"string","enum":["INVOICE","CREDIT_NOTE"]},"status":{"type":"string","enum":["DRAFT","ISSUED"]},"number":{"type":["string","null"],"description":"Null on a draft"},"totalCents":{"type":["integer","null"],"description":"GST-inclusive; negative on a credit note; null on a draft"},"issuedAt":{"type":["string","null"],"format":"date-time","description":"Null on a draft"},"terms":{"type":"string","enum":["DUE_ON_RECEIPT","ACCOUNT"]},"dueDate":{"type":["string","null"],"format":"date","description":"YYYY-MM-DD; set with ACCOUNT terms"},"balance":{"allOf":[{"$ref":"#/components/schemas/InvoiceBalance"},{"type":["object","null"],"description":"Issued INVOICEs only; null for drafts and credit notes"}]}},"required":["id","jobId","kind","status","number","totalCents","issuedAt","terms","dueDate","balance"],"additionalProperties":false},"StationCustomerAccount":{"type":"object","properties":{"customerId":{"type":"string"},"bookings":{"type":"array","items":{"$ref":"#/components/schemas/StationCustomerAccountBooking"}},"jobs":{"type":"array","items":{"$ref":"#/components/schemas/StationCustomerAccountJob"}},"invoices":{"type":"array","items":{"$ref":"#/components/schemas/StationCustomerAccountInvoice"}},"payments":{"type":"array","items":{"$ref":"#/components/schemas/RecordedPayment"},"description":"Payments and refunds on this customer's issued invoices, oldest first"},"outstandingBalanceCents":{"type":"integer","description":"Sum of the balance of this customer's issued INVOICEs at this station"}},"required":["customerId","bookings","jobs","invoices","payments","outstandingBalanceCents"],"additionalProperties":false},"StationCustomerAccountSummary":{"type":"object","properties":{"customerId":{"type":["string","null"],"description":"Null for an invoice with no customer (a walk-in)"},"invoiceId":{"type":["string","null"],"description":"Set on a row with no customer (one row per such invoice); else null"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"rego":{"type":["string","null"],"description":"The invoice's billToRego on a row with no customer; null for a customer"},"outstandingBalanceCents":{"type":"integer","description":"Sum of the balances still owing on the issued INVOICEs"},"outstandingInvoiceCount":{"type":"integer"},"oldestIssuedAt":{"type":"string","format":"date-time","description":"Issue time of the oldest invoice still owing"},"earliestDueDate":{"type":["string","null"],"format":"date","description":"YYYY-MM-DD; the earliest due date among the invoices owing, if any"},"overdueCents":{"type":"integer","description":"Balance owing on invoices due before the station-local today"}},"required":["customerId","invoiceId","name","phone","rego","outstandingBalanceCents","outstandingInvoiceCount","oldestIssuedAt","earliestDueDate","overdueCents"],"additionalProperties":false},"UploadedImage":{"type":"object","properties":{"url":{"type":"string","description":"HTTPS CloudFront (CDN) URL of the stored WebP. Never a raw S3 URL.","example":"https://images.getmypinkslip.com.au/blog/hero/3f0c2a6e-9b1d-4c1e-8f53-0d2b7a9e4c11.webp"},"key":{"type":"string","description":"Object key in the uploads bucket","example":"blog/hero/3f0c2a6e-9b1d-4c1e-8f53-0d2b7a9e4c11.webp"},"width":{"type":"integer","description":"Output width in pixels"},"height":{"type":"integer","description":"Output height in pixels"},"bytes":{"type":"integer","description":"Size of the stored main WebP in bytes"},"variants":{"type":"object","properties":{"1280w":{"type":"string","format":"uri"},"1024w":{"type":"string","format":"uri"},"768w":{"type":"string","format":"uri"}},"required":["1280w","1024w","768w"],"description":"HTTPS CDN URLs of the responsive WebP variants; never enlarged."}},"required":["url","key","width","height","bytes","variants"]}},"parameters":{}},"paths":{"/api/v1/health":{"get":{"tags":["Health"],"summary":"Health check","responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"version":{"type":"string"},"sha":{"type":"string"},"environment":{"type":"string","enum":["development","staging","production"]}},"required":["status","version","sha","environment"]}},"required":["data"]}}}}}}},"/api/v1/founding-offer":{"get":{"tags":["Stations"],"summary":"Founding-stations offer","description":"The founding-stations offer (#1501) on a station's first subscription: a free trial, and a percentage off for a fixed number of months from sign-up (the trial counts toward them). Public; cacheable for 5 minutes. `active` is true only while the Stripe promotion code is live; the code itself is never exposed.","responses":{"200":{"description":"The offer terms when it is on, otherwise `{ active: false }`","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"anyOf":[{"type":"object","properties":{"active":{"type":"boolean","enum":[true]},"percentOff":{"type":"number"},"durationMonths":{"type":"integer"},"trialDays":{"type":"integer"}},"required":["active","percentOff","durationMonths","trialDays"]},{"type":"object","properties":{"active":{"type":"boolean","enum":[false]}},"required":["active"]}]}},"required":["data"]}}}}}}},"/api/v1/meta/min-app-version":{"get":{"tags":["Health"],"summary":"Minimum supported app versions","description":"App-to-API compatibility contract (#1011). A client sending `X-App-Version` below its platform's minimum gets `426 APP_UPGRADE_REQUIRED` on `/api/v1/station/*`, with `details: { minVersion, storeUrl }`. Public; cacheable for 5 minutes.","responses":{"200":{"description":"Minimum store versions, the API version and store links","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"ios":{"type":"string"},"android":{"type":"string"},"apiVersion":{"type":"string"},"storeUrls":{"type":"object","properties":{"ios":{"type":["string","null"]},"android":{"type":["string","null"]}},"required":["ios","android"]}},"required":["ios","android","apiVersion","storeUrls"]}},"required":["data"]}}}}}}},"/api/v1/stations":{"get":{"tags":["Stations"],"summary":"List stations","description":"Search and paginate inspection stations with geo, online booking, eSafety, open-now and vehicle-class filters. nextFree is the earliest bookable instant in the next 14 station-local days, or null. Pass nextFree=false to skip that lookup: every nextFree is then null and the other filters apply unchanged. meta.truncated is only set on the in-memory paths when the 2,000-candidate cap cuts the result set, so meta.total (a total count) and meta.bookableTotal (the bookable count) are both lower bounds. meta.bookableTotalTruncated is present whenever the bookable count is a lower bound, alongside meta.truncated on capped in-memory searches or alone on DB-paged searches. On DB-paged searches meta.total is an exact SQL count and never truncated, but the bounded verified read can cap. Both flags are absent when their respective counts are exact.","parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"suburb","in":"query"},{"schema":{"type":"string"},"required":false,"name":"postcode","in":"query"},{"schema":{"type":["number","null"],"minimum":-90,"maximum":90},"required":false,"name":"lat","in":"query"},{"schema":{"type":["number","null"],"minimum":-180,"maximum":180},"required":false,"name":"lng","in":"query"},{"schema":{"type":"number","exclusiveMinimum":0,"default":10},"required":false,"name":"radius","in":"query"},{"schema":{"type":"string","maxLength":128},"required":false,"name":"search","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}]},"required":false,"name":"bookOnline","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}]},"required":false,"name":"eSafety","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}]},"required":false,"name":"openNow","in":"query"},{"schema":{"type":"string","enum":["light","heavy","motorcycle","trailer"]},"required":false,"name":"vehicleClass","in":"query"},{"schema":{"type":"string","enum":["recommended","nearest"]},"required":false,"name":"sort","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}],"description":"Set false to skip the next-free-slot lookup: nextFree is then null for every station. Absent or true computes it."},"required":false,"description":"Set false to skip the next-free-slot lookup: nextFree is then null for every station. Absent or true computes it.","name":"nextFree","in":"query"},{"schema":{"anyOf":[{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]},{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]}}]},"required":false,"name":"accreditation","in":"query"}],"responses":{"200":{"description":"Paginated list of stations","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"address":{"type":"string"},"suburb":{"type":"string"},"postcode":{"type":"string"},"state":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"},"phone":{"type":["string","null"]},"accreditations":{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]}},"isActive":{"type":"boolean"},"isPremium":{"type":"boolean"},"distanceKm":{"type":"number"},"googleRating":{"type":["number","null"]},"googleReviewCount":{"type":["number","null"]},"heroImageUrl":{"type":["string","null"]},"bookable":{"type":"boolean"},"nextFree":{"type":["string","null"],"format":"date-time"}},"required":["id","name","slug","address","suburb","postcode","state","latitude","longitude","phone","accreditations","isActive","isPremium","googleRating","googleReviewCount","heroImageUrl","bookable"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"},"bookableTotal":{"type":"integer","minimum":0},"truncated":{"type":"boolean","description":"Total truncation: present and true only when the 2,000-candidate cap cut an in-memory search, so meta.total and meta.bookableTotal are lower bounds."},"bookableTotalTruncated":{"type":"boolean","enum":[true],"description":"Bookable count truncation: present and true only when meta.bookableTotal is a lower bound. meta.total may still be exact (DB-paged); see meta.truncated for total truncation."},"geocoding":{"type":"object","properties":{"resolved":{"type":"boolean","enum":[false]},"reason":{"type":"string","enum":["not_found","unavailable"]},"query":{"type":"string"}},"required":["resolved","reason","query"]}},"required":["page","limit","total","totalPages","bookableTotal"]}},"required":["data","meta"]}}}}}}},"/api/v1/stations/map-points":{"get":{"tags":["Stations"],"summary":"Map points for a station search","description":"Every station matching a search, reduced to what the map plots (#1158). Takes the same filters as the list, without paging, capped at 2,000 rows; `truncated` is true when the cap applied.","parameters":[{"schema":{"type":"string"},"required":false,"name":"suburb","in":"query"},{"schema":{"type":"string"},"required":false,"name":"postcode","in":"query"},{"schema":{"type":["number","null"],"minimum":-90,"maximum":90},"required":false,"name":"lat","in":"query"},{"schema":{"type":["number","null"],"minimum":-180,"maximum":180},"required":false,"name":"lng","in":"query"},{"schema":{"type":"number","exclusiveMinimum":0,"maximum":100,"default":10},"required":false,"name":"radius","in":"query"},{"schema":{"type":"string","maxLength":128},"required":false,"name":"search","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}]},"required":false,"name":"eSafety","in":"query"},{"schema":{"type":"string","enum":["light","heavy","motorcycle","trailer"]},"required":false,"name":"vehicleClass","in":"query"},{"schema":{"anyOf":[{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]},{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]}}]},"required":false,"name":"accreditation","in":"query"}],"responses":{"200":{"description":"Map points for every match","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"suburb":{"type":"string"},"state":{"type":"string"},"postcode":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"},"isPremium":{"type":"boolean"}},"required":["id","slug","name","suburb","state","postcode","latitude","longitude","isPremium"]}},"meta":{"type":"object","properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"truncated":{"type":"boolean"},"area":{"type":"object","properties":{"lat":{"type":"number"},"lng":{"type":"number"},"radiusKm":{"type":"number"}},"required":["lat","lng","radiusKm"]},"geocoding":{"type":"object","properties":{"resolved":{"type":"boolean","enum":[false]},"reason":{"type":"string","enum":["not_found","unavailable"]},"query":{"type":"string"}},"required":["resolved","reason","query"]}},"required":["total","limit","truncated"]}},"required":["data","meta"]}}}}}}},"/api/v1/stations/delisted":{"get":{"tags":["Stations"],"summary":"List delisted station slugs","description":"Slugs of stations delisted from the NSW register (#1123). Their detail and reviews answer 410 Gone. `stations` dates each delisting, for the web sitemap of removed URLs (#1247).","responses":{"200":{"description":"Delisted station slugs, each with its delisting time","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"slugs":{"type":"array","items":{"type":"string"}},"stations":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string"},"delistedAt":{"type":"string"}},"required":["slug","delistedAt"]}}},"required":["slugs","stations"]}},"required":["data"]}}}}}}},"/api/v1/stations/active-slugs":{"get":{"tags":["Stations"],"summary":"List every listed station slug","description":"Slugs of every active station in one response, for the web sitemap (#1230). Same filter as the station list.","responses":{"200":{"description":"Active station slugs","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"slugs":{"type":"array","items":{"type":"string"}}},"required":["slugs"]}},"required":["data"]}}}}}}},"/api/v1/stations/directory":{"get":{"tags":["Stations"],"summary":"List every listed station as a directory row","description":"Slug, name, suburb, state and postcode of every active station in one response, for the web /llms.txt (#1267). Same filter and order as the station list.","responses":{"200":{"description":"Station directory","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"},"suburb":{"type":"string"},"state":{"type":"string"},"postcode":{"type":"string"}},"required":["slug","name","suburb","state","postcode"]}}},"required":["data"]}}}}}}},"/api/v1/stations/{slug}":{"get":{"tags":["Stations"],"summary":"Get station by slug","description":"nextFree is the earliest bookable instant in the next 14 station-local days, or null. Pass nextFree=false to skip that lookup: nextFree is then null.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}],"description":"Set false to skip the next-free-slot lookup: nextFree is then null for every station. Absent or true computes it."},"required":false,"description":"Set false to skip the next-free-slot lookup: nextFree is then null for every station. Absent or true computes it.","name":"nextFree","in":"query"}],"responses":{"200":{"description":"Station details","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"address":{"type":"string"},"suburb":{"type":"string"},"postcode":{"type":"string"},"state":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"},"phone":{"type":["string","null"]},"accreditations":{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]}},"isActive":{"type":"boolean"},"isPremium":{"type":"boolean"},"distanceKm":{"type":"number"},"googleRating":{"type":["number","null"]},"googleReviewCount":{"type":["number","null"]},"heroImageUrl":{"type":["string","null"]},"bookable":{"type":"boolean"},"nextFree":{"type":["string","null"],"format":"date-time"},"timezone":{"type":"string"},"email":{"type":["string","null"]},"website":{"type":["string","null"]},"description":{"type":["string","null"]},"openingHours":{"type":["object","null"],"additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]}]}},"googlePlaceId":{"type":["string","null"]},"googleMapsUri":{"type":["string","null"]},"businessStatus":{"type":["string","null"]},"enrichment":{"type":["object","null"],"properties":{"photos":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"widthPx":{"type":"number"},"heightPx":{"type":"number"}},"required":["url","widthPx","heightPx"]}},"googleReviews":{"type":"array","items":{"type":"object","properties":{"author":{"type":["string","null"]},"rating":{"type":["number","null"]},"text":{"type":["string","null"]},"publishTime":{"type":["string","null"]}},"required":["author","rating","text","publishTime"]}},"socialLinks":{"type":"object","properties":{"facebook":{"type":"string"},"instagram":{"type":"string"},"twitter":{"type":"string"},"tiktok":{"type":"string"},"youtube":{"type":"string"},"linkedin":{"type":"string"}}},"googleOpeningHours":{"type":"array","items":{"type":"string"}}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"coordinatePrecision":{"type":["string","null"],"enum":["PREMISE",null]}},"required":["id","name","slug","address","suburb","postcode","state","latitude","longitude","phone","accreditations","isActive","isPremium","googleRating","googleReviewCount","heroImageUrl","bookable","timezone","email","website","description","openingHours","googlePlaceId","googleMapsUri","businessStatus","enrichment","createdAt","updatedAt","coordinatePrecision"]}},"required":["data"]}}}},"404":{"description":"Station not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Station delisted from the NSW register (code STATION_DELISTED)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["STATION_DELISTED"]},"message":{"type":"string"},"details":{"type":"object","properties":{"name":{"type":"string"},"suburb":{"type":"string"},"postcode":{"type":"string"},"delistedAt":{"type":"string","format":"date-time"},"latitude":{"type":"number"},"longitude":{"type":"number"}},"required":["name","suburb","postcode","delistedAt","latitude","longitude"],"additionalProperties":false}},"required":["code","message","details"]}},"required":["error"]}}}}}}},"/api/v1/stations/{slug}/availability":{"get":{"tags":["Stations"],"summary":"Get station availability","description":"Returns 30-minute time slots for the requested month.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"required":true,"name":"month","in":"query"}],"responses":{"200":{"description":"Monthly availability with time slots","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"stationId":{"type":"string"},"month":{"type":"string"},"days":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"mode":{"type":"string","enum":["SLOT","DAY"]},"paymentTiming":{"type":"string","enum":["AT_STATION","PREPAY_OPTIONAL","PREPAY_REQUIRED"]},"prices":{"type":"object","properties":{"inspectionCents":{"type":["integer","null"]},"prepaidInspectionCents":{"type":["integer","null"]},"calloutFeeCents":{"type":["integer","null"]}},"required":["inspectionCents","prepaidInspectionCents","calloutFeeCents"]},"dropOffWindow":{"type":["object","null"],"properties":{"open":{"type":"string"},"close":{"type":"string"}},"required":["open","close"]},"capacityRemaining":{"type":"number"},"slots":{"type":"array","items":{"type":"object","properties":{"time":{"type":"string"},"available":{"type":"boolean"}},"required":["time","available"]}}},"required":["date","mode","paymentTiming","prices","dropOffWindow","capacityRemaining","slots"]}}},"required":["stationId","month","days"]}},"required":["data"]}}}},"404":{"description":"Station not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/stations/{slug}/reviews":{"get":{"tags":["Stations"],"summary":"List station reviews","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"},{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Paginated reviews","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"rating":{"type":"number"},"comment":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","rating","comment","customerFirstName","customerLastName","createdAt"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}},"404":{"description":"Station not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Station delisted from the NSW register (code STATION_DELISTED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/towns":{"get":{"tags":["MOT"],"summary":"List UK towns with MOT garages","description":"Towns with at least one garage on the DVSA active MOT stations register, sorted by name. Each town carries its `nation`, its `region` (the most common across its garages; England only, null in Scotland and Wales), its `bookableCount` (garages taking online bookings) and its centroid `latitude`/`longitude` (the mean of its geocoded garages; null when none is geocoded). UK platform only.","responses":{"200":{"description":"Towns, sorted by name","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"garageCount":{"type":"integer","minimum":0},"nation":{"type":["string","null"],"enum":["ENG","SCT","WLS",null]},"region":{"type":["string","null"],"minLength":1},"bookableCount":{"type":"integer","minimum":0},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180}},"required":["slug","name","garageCount"]}}},"required":["data"]}}}}}}},"/api/v1/mot/towns/{slug}":{"get":{"tags":["MOT"],"summary":"Get a UK town with its intro page","description":"The town as in `/mot/towns` (nation, region, bookableCount, centroid), with its intro `page`: the public fields of a PUBLISHED page, or of a SCHEDULED one whose scheduled time has passed; null when the town has no such page. UK platform only.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"The town and its intro page, or page null","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"garageCount":{"type":"integer","minimum":0},"nation":{"type":["string","null"],"enum":["ENG","SCT","WLS",null]},"region":{"type":["string","null"],"minLength":1},"bookableCount":{"type":"integer","minimum":0},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"page":{"type":["object","null"],"properties":{"intro":{"type":"string","minLength":1},"heroImage":{"type":["string","null"]},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"},"description":"Responsive webp variants of heroImage by width (1280w, 1024w, 768w)"},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]}},"required":["intro","heroImage","heroImageVariants","metaTitle","metaDescription"]}},"required":["slug","name","garageCount","page"]}},"required":["data"]}}}},"404":{"description":"No listed garage in this town (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/towns/{slug}/garages":{"get":{"tags":["MOT"],"summary":"List a town's MOT garages","description":"One page of the town's listed garages, sorted by name, optionally only those testing `class`. UK platform only.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","enum":["CLASS_1","CLASS_2","CLASS_3","CLASS_4","CLASS_5","CLASS_7"]},"required":false,"name":"class","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"pageSize","in":"query"}],"responses":{"200":{"description":"Paginated garages (an empty page when none tests the class)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"dvsaSiteNumber":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"addressLines":{"type":"array","items":{"type":"string","minLength":1},"maxItems":3},"town":{"type":"string","minLength":1},"postcode":{"type":"string","minLength":1},"phone":{"type":["string","null"],"minLength":1},"testClasses":{"type":"array","items":{"type":"string","enum":["CLASS_1","CLASS_2","CLASS_3","CLASS_4","CLASS_5","CLASS_7"]}},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"bookable":{"type":"boolean"},"pricePence":{"type":["integer","null"],"minimum":0}},"required":["dvsaSiteNumber","name","addressLines","town","postcode","phone","testClasses","latitude","longitude"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}},"400":{"description":"Unknown class, or page/pageSize out of range (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No listed garage in this town (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/towns/{slug}/nearby":{"get":{"tags":["MOT"],"summary":"List a town's postcode districts and nearby towns","description":"`districts` are the town's own outward codes with their listed-garage counts, ordered SW1, SW1A, SW2, SW11. `towns` are the 8 nearest other towns by centroid distance, nearest first, as in `/mot/towns`; the town itself is excluded, and there are none when the town has no centroid. UK platform only.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"The town's districts and its nearest other towns","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"districts":{"type":"array","items":{"type":"object","properties":{"district":{"type":"string","minLength":2,"maxLength":4,"description":"An outward code, upper-cased without spaces","example":"SW11"},"garageCount":{"type":"integer","minimum":0}},"required":["district","garageCount"]}},"towns":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"garageCount":{"type":"integer","minimum":0},"nation":{"type":["string","null"],"enum":["ENG","SCT","WLS",null]},"region":{"type":["string","null"],"minLength":1},"bookableCount":{"type":"integer","minimum":0},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180}},"required":["slug","name","garageCount"]}}},"required":["districts","towns"]}},"required":["data"]}}}},"404":{"description":"No listed garage in this town (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/areas":{"get":{"tags":["MOT"],"summary":"Search postcode districts and towns","description":"Districts whose outward code starts with `q` (spaces and case ignored) and towns whose name starts with `q`, at most 10 of each, with their listed-garage counts; towns as in `/mot/towns`. Rate limited. UK platform only.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"q","in":"query"}],"responses":{"200":{"description":"Matching districts and towns","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"districts":{"type":"array","items":{"type":"object","properties":{"district":{"type":"string","minLength":2,"maxLength":4,"description":"An outward code, upper-cased without spaces","example":"SW11"},"garageCount":{"type":"integer","minimum":0}},"required":["district","garageCount"]}},"towns":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"garageCount":{"type":"integer","minimum":0},"nation":{"type":["string","null"],"enum":["ENG","SCT","WLS",null]},"region":{"type":["string","null"],"minLength":1},"bookableCount":{"type":"integer","minimum":0},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180}},"required":["slug","name","garageCount"]}}},"required":["districts","towns"]}},"required":["data"]}}}},"400":{"description":"Missing or empty q, or longer than 64 characters (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests (RATE_LIMITED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/areas/{district}/garages":{"get":{"tags":["MOT"],"summary":"List a postcode district's MOT garages","description":"One page of the postcode district's listed garages, as for a town: sorted by name, optionally only those testing `class`. `district` is an outward code, case-insensitive (`sw11` is `SW11`). UK platform only.","parameters":[{"schema":{"type":"string","maxLength":16,"description":"An outward code, case-insensitive; not a full postcode","example":"SW11"},"required":true,"description":"An outward code, case-insensitive; not a full postcode","name":"district","in":"path"},{"schema":{"type":"string","enum":["CLASS_1","CLASS_2","CLASS_3","CLASS_4","CLASS_5","CLASS_7"]},"required":false,"name":"class","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"pageSize","in":"query"}],"responses":{"200":{"description":"Paginated garages (an empty page when none tests the class)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"dvsaSiteNumber":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"addressLines":{"type":"array","items":{"type":"string","minLength":1},"maxItems":3},"town":{"type":"string","minLength":1},"postcode":{"type":"string","minLength":1},"phone":{"type":["string","null"],"minLength":1},"testClasses":{"type":"array","items":{"type":"string","enum":["CLASS_1","CLASS_2","CLASS_3","CLASS_4","CLASS_5","CLASS_7"]}},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"bookable":{"type":"boolean"},"pricePence":{"type":["integer","null"],"minimum":0}},"required":["dvsaSiteNumber","name","addressLines","town","postcode","phone","testClasses","latitude","longitude"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}},"400":{"description":"Not an outward code (a full postcode or junk), unknown class, or page/pageSize out of range (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No listed garage in this postcode district (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/garages/near":{"get":{"tags":["MOT"],"summary":"List the MOT garages nearest a postcode","description":"The nearest listed garages to a full or outward postcode, nearest first, optionally only those testing `class`. `bookable` and `pricePence` come from the garage's diary; `pricePence` is the lowest accepted price for `class`, null without one. A Northern Ireland (BT) postcode answers `region: NI` with no garages. Rate limited. UK platform only.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":16},"required":true,"name":"postcode","in":"query"},{"schema":{"type":"string","enum":["CLASS_1","CLASS_2","CLASS_3","CLASS_4","CLASS_5","CLASS_7"]},"required":false,"name":"class","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Garages nearest first, with the geocoded origin","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"oneOf":[{"type":"object","properties":{"region":{"type":"string","enum":["GB"]},"origin":{"type":"object","properties":{"postcode":{"type":["string","null"],"minLength":1},"outcode":{"type":"string","minLength":1},"latitude":{"type":"number","minimum":-90,"maximum":90},"longitude":{"type":"number","minimum":-180,"maximum":180}},"required":["postcode","outcode","latitude","longitude"]},"garages":{"type":"array","items":{"type":"object","properties":{"dvsaSiteNumber":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"addressLines":{"type":"array","items":{"type":"string","minLength":1},"maxItems":3},"town":{"type":"string","minLength":1},"postcode":{"type":"string","minLength":1},"phone":{"type":["string","null"],"minLength":1},"testClasses":{"type":"array","items":{"type":"string","enum":["CLASS_1","CLASS_2","CLASS_3","CLASS_4","CLASS_5","CLASS_7"]}},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"bookable":{"type":"boolean"},"pricePence":{"type":["integer","null"],"minimum":0},"distanceMiles":{"type":"number","minimum":0}},"required":["dvsaSiteNumber","name","addressLines","town","postcode","phone","testClasses","latitude","longitude","distanceMiles"]}}},"required":["region","origin","garages"]},{"type":"object","properties":{"region":{"type":"string","enum":["NI"]},"garages":{"type":"array","items":{"type":"object","properties":{"dvsaSiteNumber":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"addressLines":{"type":"array","items":{"type":"string","minLength":1},"maxItems":3},"town":{"type":"string","minLength":1},"postcode":{"type":"string","minLength":1},"phone":{"type":["string","null"],"minLength":1},"testClasses":{"type":"array","items":{"type":"string","enum":["CLASS_1","CLASS_2","CLASS_3","CLASS_4","CLASS_5","CLASS_7"]}},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"bookable":{"type":"boolean"},"pricePence":{"type":["integer","null"],"minimum":0},"distanceMiles":{"type":"number","minimum":0}},"required":["dvsaSiteNumber","name","addressLines","town","postcode","phone","testClasses","latitude","longitude","distanceMiles"]},"maxItems":0}},"required":["region","garages"]}]}},"required":["data"]}}}},"400":{"description":"Not a postcode or outward code, unknown class, or limit out of range (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Postcode not found (POSTCODE_NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests (RATE_LIMITED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Postcode lookup unavailable (POSTCODE_LOOKUP_UNAVAILABLE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/garages/{siteNumber}/availability":{"get":{"tags":["MOT"],"summary":"A garage's MOT slots and price for a vehicle","description":"The garage diary's slots from `from` to `to` (at most 31 days) for the bays that take the vehicle's class group, with the garage's full price for the vehicle's fee band. The vehicle is given as `vehicleType` with `passengerSeats` (needed for a minibus), `sidecar` and `seatBeltCheck` (9 or more seats). `postcode` is the driver's, optional; a Northern Ireland (BT) one is refused. Public. UK platform only.","parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9]{1,20}$"},"required":true,"name":"siteNumber","in":"path"},{"schema":{"type":"string","enum":["SMALL_MOTORBIKE","MOTORBIKE","THREE_WHEELER","CAR_OR_SMALL_VAN","MINIBUS","VAN_OVER_3_TONNES"]},"required":true,"name":"vehicleType","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"passengerSeats","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"sidecar","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"seatBeltCheck","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":true,"name":"from","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":true,"name":"to","in":"query"},{"schema":{"type":"string","minLength":2,"maxLength":10},"required":false,"name":"postcode","in":"query"}],"responses":{"200":{"description":"Availability for the vehicle","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"motClass":{"type":"string","enum":["CLASS_1","CLASS_2","CLASS_3","CLASS_4","CLASS_5","CLASS_7"]},"stationClass":{"type":"string","enum":["CLASS_1","CLASS_2","CLASS_3","CLASS_4","CLASS_5","CLASS_7"]},"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"slotMinutes":{"type":"integer","exclusiveMinimum":0},"bays":{"type":"array","items":{"type":"string"}},"price":{"type":"object","properties":{"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0},"maximumPence":{"type":"integer","minimum":0}},"required":["pricePence","cardFeePence","maximumPence"]},"days":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"closedReason":{"type":["string","null"],"enum":["CLOSED","BANK_HOLIDAY",null]},"slots":{"type":"array","items":{"type":"object","properties":{"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"available":{"type":"boolean"}},"required":["time","available"]}}},"required":["date","closedReason","slots"]}}},"required":["motClass","stationClass","classGroup","feeBandId","slotMinutes","bays","price","days"]}},"required":["data"]}}}},"400":{"description":"Invalid site number, vehicle choice or date range (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such garage (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"The driver or the garage is in Northern Ireland (MOT_NORTHERN_IRELAND), the garage has no diary because no Business has claimed it (MOT_GARAGE_NOT_BOOKABLE), the garage does not test or price this vehicle (MOT_CLASS_NOT_OFFERED), or the Business has no bank holiday data for its nation (DIARY_NATION_UNSUPPORTED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/garages/{siteNumber}/bookings":{"post":{"tags":["MOT"],"summary":"Book an MOT at a garage","description":"Books the slot in a bay that takes the vehicle's class group; the booking is CONFIRMED straight away. An optional Idempotency-Key is scoped to the customer: retrying the same key and body replays the original booking (200) without booking again, and reusing the key for another garage, vehicle, date or time returns 409 IDEMPOTENCY_KEY_REUSED. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9]{1,20}$"},"required":true,"name":"siteNumber","in":"path"},{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{8,128}$"},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"registration":{"type":"string","maxLength":20},"vehicle":{"type":"object","properties":{"vehicleType":{"type":"string","enum":["SMALL_MOTORBIKE","MOTORBIKE","THREE_WHEELER","CAR_OR_SMALL_VAN","MINIBUS","VAN_OVER_3_TONNES"]},"passengerSeats":{"type":"integer","minimum":1,"maximum":100},"sidecar":{"type":"boolean"},"seatBeltCheck":{"type":"boolean"}},"required":["vehicleType"]},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"name":{"type":"string","minLength":1,"maxLength":100},"phone":{"type":"string"},"email":{"type":"string","maxLength":254,"format":"email"},"postcode":{"type":"string","minLength":2,"maxLength":10}},"required":["registration","vehicle","date","time","name","phone","email"]}}}},"responses":{"200":{"description":"Original booking replayed for the same key and body","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"bookingId":{"type":"string"},"status":{"type":"string","enum":["CONFIRMED"]},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"durationMinutes":{"type":"integer","exclusiveMinimum":0},"bay":{"type":"string"},"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"price":{"type":"object","properties":{"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0},"maximumPence":{"type":"integer","minimum":0}},"required":["pricePence","cardFeePence","maximumPence"]}},"required":["bookingId","status","date","time","durationMinutes","bay","classGroup","feeBandId","price"]}},"required":["data"]}}}},"201":{"description":"Booking created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"bookingId":{"type":"string"},"status":{"type":"string","enum":["CONFIRMED"]},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"durationMinutes":{"type":"integer","exclusiveMinimum":0},"bay":{"type":"string"},"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"price":{"type":"object","properties":{"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0},"maximumPence":{"type":"integer","minimum":0}},"required":["pricePence","cardFeePence","maximumPence"]}},"required":["bookingId","status","date","time","durationMinutes","bay","classGroup","feeBandId","price"]}},"required":["data"]}}}},"400":{"description":"Invalid body, site number or Idempotency-Key (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such garage (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Every bay of the class group is taken for that time (SLOT_UNAVAILABLE), or the Idempotency-Key was already used for a different booking (IDEMPOTENCY_KEY_REUSED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"The driver or the garage is in Northern Ireland (MOT_NORTHERN_IRELAND), the garage has no diary because no Business has claimed it (MOT_GARAGE_NOT_BOOKABLE), the garage does not test or price this vehicle (MOT_CLASS_NOT_OFFERED), or the Business has no bank holiday data for its nation (DIARY_NATION_UNSUPPORTED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: too many booking requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/me/bookings":{"get":{"tags":["MOT"],"summary":"The signed-in driver's MOT bookings","description":"The signed-in driver's GetMyMOT bookings. `scope=upcoming` (the default) is the pending, confirmed and checked-in (CHECKED_IN) bookings, each until its slot ends on the garage's clock, soonest first; `scope=past` is everything else, newest first: completed, cancelled and no-show bookings, and those whose slot has ended. A moved booking shows once, as the booking that replaced it: its RESCHEDULED original is in neither scope, and is read by id. Each booking carries `canCancel` and `canMove` (pending or confirmed and the slot has not started, so false once it has started though it is still upcoming) and `movedToId`, the booking that replaced a moved one. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["upcoming","past"],"default":"upcoming"},"required":false,"name":"scope","in":"query"}],"responses":{"200":{"description":"The driver's bookings","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"status":{"type":"string","enum":["PENDING","CONFIRMED","CHECKED_IN","COMPLETED","CANCELLED","NO_SHOW","RESCHEDULED"]},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"durationMinutes":{"type":["integer","null"],"exclusiveMinimum":0},"vehicle":{"type":"object","properties":{"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"registration":{"type":["string","null"],"minLength":1}},"required":["classGroup","feeBandId","registration"]},"garage":{"type":"object","properties":{"siteNumber":{"type":["string","null"],"minLength":1},"name":{"type":"string","minLength":1},"addressLines":{"type":"array","items":{"type":"string","minLength":1},"maxItems":3},"town":{"type":["string","null"]},"postcode":{"type":["string","null"]},"phone":{"type":["string","null"],"minLength":1}},"required":["siteNumber","name","addressLines","town","postcode","phone"]},"price":{"type":"object","properties":{"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0},"maximumPence":{"type":"integer","minimum":0}},"required":["pricePence","cardFeePence","maximumPence"]},"canCancel":{"type":"boolean"},"canMove":{"type":"boolean"},"movedToId":{"type":["string","null"],"minLength":1}},"required":["id","status","date","time","durationMinutes","vehicle","garage","price","canCancel","canMove","movedToId"]}}},"required":["data"]}}}},"400":{"description":"Invalid scope (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/me/bookings/{id}":{"get":{"tags":["MOT"],"summary":"One of the signed-in driver's MOT bookings","description":"One booking with the garage, vehicle and price snapshot, and `result` (null until the results Task records one). Another customer's booking is 404, never 403. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The booking","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","minLength":1},"status":{"type":"string","enum":["PENDING","CONFIRMED","CHECKED_IN","COMPLETED","CANCELLED","NO_SHOW","RESCHEDULED"]},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"durationMinutes":{"type":["integer","null"],"exclusiveMinimum":0},"vehicle":{"type":"object","properties":{"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"registration":{"type":["string","null"],"minLength":1}},"required":["classGroup","feeBandId","registration"]},"garage":{"type":"object","properties":{"siteNumber":{"type":["string","null"],"minLength":1},"name":{"type":"string","minLength":1},"addressLines":{"type":"array","items":{"type":"string","minLength":1},"maxItems":3},"town":{"type":["string","null"]},"postcode":{"type":["string","null"]},"phone":{"type":["string","null"],"minLength":1}},"required":["siteNumber","name","addressLines","town","postcode","phone"]},"price":{"type":"object","properties":{"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0},"maximumPence":{"type":"integer","minimum":0}},"required":["pricePence","cardFeePence","maximumPence"]},"canCancel":{"type":"boolean"},"canMove":{"type":"boolean"},"movedToId":{"type":["string","null"],"minLength":1},"result":{"type":"null"}},"required":["id","status","date","time","durationMinutes","vehicle","garage","price","canCancel","canMove","movedToId","result"]}},"required":["data"]}}}},"400":{"description":"Invalid booking id (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, or it is not the signed-in driver's (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/me/bookings/{id}/cancel":{"post":{"tags":["MOT"],"summary":"Cancel one of the signed-in driver's MOT bookings","description":"Cancels a pending or confirmed booking whose slot has not started and frees the slot. Idempotent: an already cancelled booking answers 200 unchanged. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The cancelled booking (also when it was already cancelled)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","minLength":1},"status":{"type":"string","enum":["PENDING","CONFIRMED","CHECKED_IN","COMPLETED","CANCELLED","NO_SHOW","RESCHEDULED"]},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"durationMinutes":{"type":["integer","null"],"exclusiveMinimum":0},"vehicle":{"type":"object","properties":{"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"registration":{"type":["string","null"],"minLength":1}},"required":["classGroup","feeBandId","registration"]},"garage":{"type":"object","properties":{"siteNumber":{"type":["string","null"],"minLength":1},"name":{"type":"string","minLength":1},"addressLines":{"type":"array","items":{"type":"string","minLength":1},"maxItems":3},"town":{"type":["string","null"]},"postcode":{"type":["string","null"]},"phone":{"type":["string","null"],"minLength":1}},"required":["siteNumber","name","addressLines","town","postcode","phone"]},"price":{"type":"object","properties":{"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0},"maximumPence":{"type":"integer","minimum":0}},"required":["pricePence","cardFeePence","maximumPence"]},"canCancel":{"type":"boolean"},"canMove":{"type":"boolean"},"movedToId":{"type":["string","null"],"minLength":1},"result":{"type":"null"}},"required":["id","status","date","time","durationMinutes","vehicle","garage","price","canCancel","canMove","movedToId","result"]}},"required":["data"]}}}},"400":{"description":"Invalid booking id (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, or it is not the signed-in driver's (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The slot has started, or the booking is not pending or confirmed (GMM_BOOKING_NOT_CANCELLABLE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: too many booking requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/me/bookings/{id}/move":{"post":{"tags":["MOT"],"summary":"Move one of the signed-in driver's MOT bookings to another slot","description":"Moves a pending or confirmed booking to another free slot at the same garage for the same vehicle band; the price snapshot is kept. The answer is the new booking; the old one becomes RESCHEDULED (`movedToId` names the new one) and its slot is released only once the new slot is taken, so a refused move (409 SLOT_UNAVAILABLE) leaves the original untouched. The date and time must be a future slot on the garage's grid and not the booking's own slot. An optional Idempotency-Key is scoped to the customer: retrying the same key and body replays the first move, and reusing the key for another booking or slot returns 409 IDEMPOTENCY_KEY_REUSED. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{8,128}$"},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["date","time"]}}}},"responses":{"200":{"description":"The new booking (also when the same key and body replay an earlier move)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","minLength":1},"status":{"type":"string","enum":["PENDING","CONFIRMED","CHECKED_IN","COMPLETED","CANCELLED","NO_SHOW","RESCHEDULED"]},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"durationMinutes":{"type":["integer","null"],"exclusiveMinimum":0},"vehicle":{"type":"object","properties":{"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"registration":{"type":["string","null"],"minLength":1}},"required":["classGroup","feeBandId","registration"]},"garage":{"type":"object","properties":{"siteNumber":{"type":["string","null"],"minLength":1},"name":{"type":"string","minLength":1},"addressLines":{"type":"array","items":{"type":"string","minLength":1},"maxItems":3},"town":{"type":["string","null"]},"postcode":{"type":["string","null"]},"phone":{"type":["string","null"],"minLength":1}},"required":["siteNumber","name","addressLines","town","postcode","phone"]},"price":{"type":"object","properties":{"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0},"maximumPence":{"type":"integer","minimum":0}},"required":["pricePence","cardFeePence","maximumPence"]},"canCancel":{"type":"boolean"},"canMove":{"type":"boolean"},"movedToId":{"type":["string","null"],"minLength":1},"result":{"type":"null"}},"required":["id","status","date","time","durationMinutes","vehicle","garage","price","canCancel","canMove","movedToId","result"]}},"required":["data"]}}}},"400":{"description":"Invalid body, booking id or Idempotency-Key, a slot in the past, off the garage grid or the booking's own slot (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, or it is not the signed-in driver's (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Every bay of the class group is taken for that time and the original is untouched (SLOT_UNAVAILABLE), the booking is not pending or confirmed or has started (GMM_BOOKING_NOT_MOVABLE), or the Idempotency-Key was already used for a different move (IDEMPOTENCY_KEY_REUSED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"The garage no longer has a listing, so it doesn't take online bookings any more (MOT_GARAGE_NOT_BOOKABLE; a replay of an earlier move with the same Idempotency-Key still answers 200), or it no longer tests or prices this vehicle (MOT_CLASS_NOT_OFFERED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: too many booking requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/me/vehicles":{"get":{"tags":["MOT"],"summary":"List the signed-in driver's cars","description":"The signed-in driver's GetMyMOT cars, oldest added first (at most 100): a car is added here or by booking it into a GetMyMOT garage. Make, model, MOT expiry and the latest test come from the DVSA MOT History API, cached per registration; when DVSA doesn't know the car or can't be asked the car is still listed, with those fields null. `daysLeft` counts from today in Europe/London to `motExpiresOn` and is negative once the MOT has run out. `remindersOn` is a flag only: reminders are not sent yet. UK platform only.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The driver's cars","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"registration":{"type":"string","minLength":1},"nickname":{"type":["string","null"],"minLength":1},"make":{"type":["string","null"]},"model":{"type":["string","null"]},"motExpiresOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"motExpirySource":{"type":["string","null"],"enum":["DVSA_MOT_HISTORY","FIRST_REGISTRATION",null]},"daysLeft":{"type":["integer","null"]},"remindersOn":{"type":"boolean"},"latestTest":{"type":["object","null"],"properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"result":{"type":"string","enum":["PASS","FAIL"]},"odometer":{"type":["object","null"],"properties":{"value":{"type":"integer","minimum":0},"unit":{"type":"string","enum":["mi","km"]}},"required":["value","unit"]}},"required":["date","result","odometer"]}},"required":["id","registration","nickname","make","model","motExpiresOn","motExpirySource","daysLeft","remindersOn","latestTest"]}}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests (RATE_LIMITED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["MOT"],"summary":"Add a car to the signed-in driver's cars","description":"Adds a car by registration, case- and space-insensitive (`ab12 cde` is `AB12CDE`). DVSA must know the car. Adding a car the driver already has answers 200 with that car, nickname and reminders flag unchanged; a new car answers 201 with reminders on. A driver has at most 100 cars. UK platform only.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"registration":{"type":"string","maxLength":20,"pattern":"^[A-Za-z0-9 .-]*$"}},"required":["registration"]}}}},"responses":{"200":{"description":"The driver already had this car","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","minLength":1},"registration":{"type":"string","minLength":1},"nickname":{"type":["string","null"],"minLength":1},"make":{"type":["string","null"]},"model":{"type":["string","null"]},"motExpiresOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"motExpirySource":{"type":["string","null"],"enum":["DVSA_MOT_HISTORY","FIRST_REGISTRATION",null]},"daysLeft":{"type":["integer","null"]},"remindersOn":{"type":"boolean"},"latestTest":{"type":["object","null"],"properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"result":{"type":"string","enum":["PASS","FAIL"]},"odometer":{"type":["object","null"],"properties":{"value":{"type":"integer","minimum":0},"unit":{"type":"string","enum":["mi","km"]}},"required":["value","unit"]}},"required":["date","result","odometer"]}},"required":["id","registration","nickname","make","model","motExpiresOn","motExpirySource","daysLeft","remindersOn","latestTest"]}},"required":["data"]}}}},"201":{"description":"The car, added","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","minLength":1},"registration":{"type":"string","minLength":1},"nickname":{"type":["string","null"],"minLength":1},"make":{"type":["string","null"]},"model":{"type":["string","null"]},"motExpiresOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"motExpirySource":{"type":["string","null"],"enum":["DVSA_MOT_HISTORY","FIRST_REGISTRATION",null]},"daysLeft":{"type":["integer","null"]},"remindersOn":{"type":"boolean"},"latestTest":{"type":["object","null"],"properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"result":{"type":"string","enum":["PASS","FAIL"]},"odometer":{"type":["object","null"],"properties":{"value":{"type":"integer","minimum":0},"unit":{"type":"string","enum":["mi","km"]}},"required":["value","unit"]}},"required":["date","result","odometer"]}},"required":["id","registration","nickname","make","model","motExpiresOn","motExpirySource","daysLeft","remindersOn","latestTest"]}},"required":["data"]}}}},"400":{"description":"Not a UK registration (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"DVSA has no vehicle with this registration (VEHICLE_NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The driver already has 100 cars and this is not one of them (MOT_VEHICLE_LIMIT_REACHED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests (RATE_LIMITED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"The DVSA MOT History API is not configured or not answering (VEHICLE_LOOKUP_UNAVAILABLE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/me/vehicles/{id}":{"patch":{"tags":["MOT"],"summary":"Turn a car's reminders on or off, or rename it","description":"Sets `remindersOn`, `nickname` or both; at least one is required and the body is strict. The nickname is trimmed, and an empty one or null clears it. `remindersOn` is a flag only: reminders are not sent yet. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"remindersOn":{"type":"boolean"},"nickname":{"type":["string","null"],"maxLength":40}},"additionalProperties":false}}}},"responses":{"200":{"description":"The car, changed","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","minLength":1},"registration":{"type":"string","minLength":1},"nickname":{"type":["string","null"],"minLength":1},"make":{"type":["string","null"]},"model":{"type":["string","null"]},"motExpiresOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"motExpirySource":{"type":["string","null"],"enum":["DVSA_MOT_HISTORY","FIRST_REGISTRATION",null]},"daysLeft":{"type":["integer","null"]},"remindersOn":{"type":"boolean"},"latestTest":{"type":["object","null"],"properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"result":{"type":"string","enum":["PASS","FAIL"]},"odometer":{"type":["object","null"],"properties":{"value":{"type":"integer","minimum":0},"unit":{"type":"string","enum":["mi","km"]}},"required":["value","unit"]}},"required":["date","result","odometer"]}},"required":["id","registration","nickname","make","model","motExpiresOn","motExpirySource","daysLeft","remindersOn","latestTest"]}},"required":["data"]}}}},"400":{"description":"Invalid car id or body, or neither field sent (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such car, or it is not the signed-in driver's (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests (RATE_LIMITED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["MOT"],"summary":"Remove a car from the signed-in driver's cars","description":"Unlinks the car from the driver. The vehicle itself is kept, for the driver's other records and other drivers' cars. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Removed"},"400":{"description":"Invalid car id (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such car, or it is not the signed-in driver's (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests (RATE_LIMITED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/me/vehicles/{id}/latest-result":{"get":{"tags":["MOT"],"summary":"A car's latest MOT result","description":"The latest passed or failed test in DVSA's MOT History: its London date, result, odometer and test station (the GetMyMOT garage the driver booked for that day, else DVSA's location, else null). Defects are grouped into `mustFix` (DANGEROUS, MAJOR and pre-2018 FAIL) and `advisories` (MINOR, ADVISORY, PRS and other notes). A pass has its new `expiresOn` and no retest windows. A DVSA (Great Britain) fail has the retest windows from GOV.UK's retest rules, each with the last London date it allows and its fee (free, half or full): left for repair within 10 working days, back by the end of the next working day (listed quick-fix items only), back within 10 working days, then a full retest. Working days skip weekends and the bank holidays of the booked garage's nation, or England and Wales' when no booking names the garage. After a dangerous defect only the left-for-repair and full-retest windows apply. A DVA (Northern Ireland) or CVS (HGV, bus) fail has no windows: their retest rules differ. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The latest result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"result":{"type":"string","enum":["PASS","FAIL"]},"odometer":{"type":["object","null"],"properties":{"value":{"type":"integer","minimum":0},"unit":{"type":"string","enum":["mi","km"]}},"required":["value","unit"]},"registration":{"type":"string","minLength":1},"testStation":{"type":["string","null"],"minLength":1},"expiresOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"defects":{"type":"object","properties":{"mustFix":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["DANGEROUS","MAJOR","FAIL","PRS","MINOR","ADVISORY","OTHER"]},"text":{"type":"string"}},"required":["kind","text"]}},"advisories":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["DANGEROUS","MAJOR","FAIL","PRS","MINOR","ADVISORY","OTHER"]},"text":{"type":"string"}},"required":["kind","text"]}}},"required":["mustFix","advisories"]},"retestWindows":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["LEFT_FOR_REPAIR","BACK_NEXT_WORKING_DAY","BACK_WITHIN_10_WORKING_DAYS","FULL_RETEST"]},"until":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"fee":{"type":"string","enum":["free","half","full"]}},"required":["kind","until","fee"]}}},"required":["date","result","odometer","registration","testStation","expiresOn","defects","retestWindows"]}},"required":["data"]}}}},"400":{"description":"Invalid car id (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such car, or it is not the signed-in driver's (NOT_FOUND), or DVSA has no MOT test for it (MOT_RESULT_NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests (RATE_LIMITED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"The DVSA MOT History API is not configured or not answering (VEHICLE_LOOKUP_UNAVAILABLE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/garage/settings":{"get":{"tags":["MOT"],"summary":"Get the garage's MOT diary settings and prices","description":"The signed-in garage's opening days, class groups with slot lengths, bays and band prices. Garage staff sign-in; OWNER or STAFF. UK platform only.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Diary settings and band prices","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"openingDays":{"type":"array","items":{"type":"object","properties":{"dayOfWeek":{"type":"integer","minimum":0,"maximum":6},"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["dayOfWeek","open","close"]},"maxItems":7},"classGroups":{"type":"array","items":{"type":"object","properties":{"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"slotMinutes":{"type":"integer","minimum":15,"maximum":240}},"required":["classGroup","slotMinutes"]},"maxItems":4},"bays":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":40},"classGroups":{"type":"array","items":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"minItems":1}},"required":["name","classGroups"]},"maxItems":20},"prices":{"type":"array","items":{"type":"object","properties":{"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0}},"required":["feeBandId","pricePence"]}}},"required":["openingDays","classGroups","bays","prices"]}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"No business association, or insufficient business permissions (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"The Business has no settings to show (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/garage/diary":{"put":{"tags":["MOT"],"summary":"Replace the garage's MOT diary","description":"Replaces the whole diary: opening days, the class groups the garage offers with their slot lengths (a multiple of 5 minutes), and the bays, each taking only a class group the garage offers. Garage staff sign-in; OWNER only. A bay left out is retired, or deleted if no booking ever held it; one with upcoming bookings cannot be removed (409 BAY_HAS_BOOKINGS). Listing the name of a retired bay again brings it back. UK platform only.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"openingDays":{"type":"array","items":{"type":"object","properties":{"dayOfWeek":{"type":"integer","minimum":0,"maximum":6},"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["dayOfWeek","open","close"]},"maxItems":7},"classGroups":{"type":"array","items":{"type":"object","properties":{"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"slotMinutes":{"type":"integer","minimum":15,"maximum":240}},"required":["classGroup","slotMinutes"]},"maxItems":4},"bays":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":40},"classGroups":{"type":"array","items":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"minItems":1}},"required":["name","classGroups"]},"maxItems":20}},"required":["openingDays","classGroups","bays"]}}}},"responses":{"200":{"description":"The saved settings","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"openingDays":{"type":"array","items":{"type":"object","properties":{"dayOfWeek":{"type":"integer","minimum":0,"maximum":6},"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["dayOfWeek","open","close"]},"maxItems":7},"classGroups":{"type":"array","items":{"type":"object","properties":{"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"slotMinutes":{"type":"integer","minimum":15,"maximum":240}},"required":["classGroup","slotMinutes"]},"maxItems":4},"bays":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":40},"classGroups":{"type":"array","items":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"minItems":1}},"required":["name","classGroups"]},"maxItems":20},"prices":{"type":"array","items":{"type":"object","properties":{"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0}},"required":["feeBandId","pricePence"]}}},"required":["openingDays","classGroups","bays","prices"]}},"required":["data"]}}}},"400":{"description":"Invalid diary, such as a repeated day, class group or bay name, or a bay taking a class group the garage does not offer (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not an OWNER of a Business (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Business not found (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"A bay with upcoming bookings would be removed (BAY_HAS_BOOKINGS)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/garage/prices":{"put":{"tags":["MOT"],"summary":"Replace the garage's MOT band prices","description":"Replaces every band price. A band's price is capped at its statutory maximum, and the card fee cannot take the price plus card fee over it (CLASS_1_2 £29.65, CLASS_1_2_SIDECAR £37.80, CLASS_3 £37.80, CLASS_4 £54.85, CLASS_4_9_TO_12_SEATS £57.30, CLASS_4A £64, CLASS_5_13_TO_16_SEATS £59.55, CLASS_5_OVER_16_SEATS £80.65, CLASS_5A_13_TO_16_SEATS £80.50, CLASS_5A_OVER_16_SEATS £124.50, CLASS_7 £58.60). Garage staff sign-in; OWNER only. UK platform only.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"prices":{"type":"array","items":{"type":"object","properties":{"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0}},"required":["feeBandId","pricePence"]},"maxItems":11}},"required":["prices"]}}}},"responses":{"200":{"description":"The saved settings","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"openingDays":{"type":"array","items":{"type":"object","properties":{"dayOfWeek":{"type":"integer","minimum":0,"maximum":6},"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["dayOfWeek","open","close"]},"maxItems":7},"classGroups":{"type":"array","items":{"type":"object","properties":{"classGroup":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"slotMinutes":{"type":"integer","minimum":15,"maximum":240}},"required":["classGroup","slotMinutes"]},"maxItems":4},"bays":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":40},"classGroups":{"type":"array","items":{"type":"string","enum":["MOTORBIKE","CAR","MINIBUS","LARGE_VAN"]},"minItems":1}},"required":["name","classGroups"]},"maxItems":20},"prices":{"type":"array","items":{"type":"object","properties":{"feeBandId":{"type":"string","enum":["CLASS_1_2","CLASS_1_2_SIDECAR","CLASS_3","CLASS_4","CLASS_4_9_TO_12_SEATS","CLASS_4A","CLASS_5_13_TO_16_SEATS","CLASS_5_OVER_16_SEATS","CLASS_5A_13_TO_16_SEATS","CLASS_5A_OVER_16_SEATS","CLASS_7"]},"pricePence":{"type":"integer","minimum":0},"cardFeePence":{"type":["integer","null"],"minimum":0}},"required":["feeBandId","pricePence"]}}},"required":["openingDays","classGroups","bays","prices"]}},"required":["data"]}}}},"400":{"description":"Invalid prices, such as a repeated band, a price above the statutory maximum, or a price plus card fee above it (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not an OWNER of a Business (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Business not found (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/mot/vehicles/{registration}":{"get":{"tags":["MOT"],"summary":"Look a vehicle up by registration","description":"Make, model, fuel, engine size and MOT expiry from the DVSA MOT History API. The registration is case- and space-insensitive (`ab12 cde` is `AB12CDE`). `motExpiresOn` is the latest expiry in the MOT history (`motExpirySource: DVSA_MOT_HISTORY`) or, for a vehicle with no MOT yet, the third anniversary of first registration (`FIRST_REGISTRATION`). DVSA gives no body type or weight, so `vehicleType` is a suggestion: with `vehicleTypeConfident: false` it is only the default and the driver should be asked. Found vehicles are cached for 24 hours. Public, rate limited. UK platform only.","parameters":[{"schema":{"type":"string","maxLength":20,"pattern":"^[A-Za-z0-9 .-]*$"},"required":true,"name":"registration","in":"path"}],"responses":{"200":{"description":"The vehicle","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"registration":{"type":"string"},"make":{"type":["string","null"]},"model":{"type":["string","null"]},"fuelType":{"type":["string","null"]},"engineSizeCc":{"type":["integer","null"],"exclusiveMinimum":0},"firstUsedDate":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"motExpiresOn":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"motExpirySource":{"type":["string","null"],"enum":["DVSA_MOT_HISTORY","FIRST_REGISTRATION",null]},"vehicleType":{"type":"string","enum":["CAR_OR_SMALL_VAN","VAN_OVER_3_TONNES","MOTORBIKE","MINIBUS"]},"vehicleTypeConfident":{"type":"boolean"}},"required":["registration","make","model","fuelType","engineSizeCc","firstUsedDate","motExpiresOn","motExpirySource","vehicleType","vehicleTypeConfident"]}},"required":["data"]}}}},"400":{"description":"Not a UK registration (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"DVSA has no vehicle with this registration (VEHICLE_NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests (RATE_LIMITED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"The DVSA MOT History API is not configured or not answering (VEHICLE_LOOKUP_UNAVAILABLE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/customers/me":{"get":{"tags":["Customers"],"summary":"Get or create customer profile","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Customer profile","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"phoneVerifiedAt":{"type":["string","null"]},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"smsOptOut":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","email","phone","phoneVerifiedAt","firstName","lastName","smsOptOut","createdAt"]}},"required":["data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["Customers"],"summary":"Update customer profile","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"phone":{"type":"string","maxLength":20},"firstName":{"type":"string","maxLength":100},"lastName":{"type":"string","maxLength":100},"smsOptOut":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Updated profile","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"phoneVerifiedAt":{"type":["string","null"]},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"smsOptOut":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","email","phone","phoneVerifiedAt","firstName","lastName","smsOptOut","createdAt"]}},"required":["data"]}}}}}},"delete":{"tags":["Customers"],"summary":"Delete the signed-in customer account","description":"Database erasure commits before the public Clerk user is deleted.","security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Account deleted; no response body"},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"An inspection is checked in (ACCOUNT_DELETION_CHECKED_IN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Database erasure failed (DELETION_FAILED), or erasure committed but Clerk deletion needs retry (ACCOUNT_DELETION_PENDING)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/vehicles":{"get":{"tags":["Vehicles"],"summary":"List customer vehicles","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"List of vehicles","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"rego":{"type":"string"},"regoState":{"type":"string"},"make":{"type":["string","null"]},"model":{"type":["string","null"]},"year":{"type":["number","null"]},"vin":{"type":["string","null"]}},"required":["id","rego","regoState","make","model","year","vin"]}}},"required":["data"]}}}}}},"post":{"tags":["Vehicles"],"summary":"Add a vehicle","description":"Plates are stored upper-case and unspaced. If the customer previously removed a car with the same plate and state, it is restored as the same vehicle (its booking history stays attached) with the submitted make, model, year and VIN, and the response is still 201.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"rego":{"type":"string","minLength":1,"maxLength":10},"regoState":{"type":"string","minLength":1,"maxLength":5},"make":{"type":"string","maxLength":100},"model":{"type":"string","maxLength":100},"year":{"type":"integer","minimum":1900,"maximum":2100},"vin":{"type":"string","maxLength":17}},"required":["rego","regoState"]}}}},"responses":{"201":{"description":"Vehicle created, or an archived vehicle with the same plate restored","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"rego":{"type":"string"},"regoState":{"type":"string"},"make":{"type":["string","null"]},"model":{"type":["string","null"]},"year":{"type":["number","null"]},"vin":{"type":["string","null"]}},"required":["id","rego","regoState","make","model","year","vin"]}},"required":["data"]}}}},"409":{"description":"The plate is already in the customer's garage (VEHICLE_ALREADY_EXISTS), or the vehicle changed during the write (VEHICLE_WRITE_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/vehicles/{id}":{"put":{"tags":["Vehicles"],"summary":"Update a vehicle","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"regoState":{"type":"string","minLength":1,"maxLength":5},"make":{"type":"string","maxLength":100},"model":{"type":"string","maxLength":100},"year":{"type":"integer","minimum":1900,"maximum":2100},"vin":{"type":"string","maxLength":17}}}}}},"responses":{"200":{"description":"Updated vehicle","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"rego":{"type":"string"},"regoState":{"type":"string"},"make":{"type":["string","null"]},"model":{"type":["string","null"]},"year":{"type":["number","null"]},"vin":{"type":["string","null"]}},"required":["id","rego","regoState","make","model","year","vin"]}},"required":["data"]}}}},"403":{"description":"The vehicle belongs to another customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Vehicle not found, or it was removed (archived)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The customer already has this plate registered in that state (VEHICLE_ALREADY_EXISTS), or the vehicle changed during the write (VEHICLE_WRITE_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Vehicles"],"summary":"Remove a vehicle","description":"Removes the car from the customer's garage. A car with any booking history is archived, not deleted, so stations and the customer still see its bookings; a car that was never booked is deleted outright. Either way the response is 200 { deleted: true }. Archived cars drop out of the list and return 404 on update or remove. Open bookings dated today or later in the station's timezone block removal with 409 VEHICLE_HAS_UPCOMING_BOOKING. Adding the same plate and state again via POST /api/v1/vehicles restores an archived car.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Vehicle removed (archived if it has booking history, otherwise deleted)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"]}},"required":["data"]}}}},"403":{"description":"The vehicle belongs to another customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Vehicle not found, or already removed (archived)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The vehicle has an upcoming booking (VEHICLE_HAS_UPCOMING_BOOKING); cancel it first. VEHICLE_WRITE_CONFLICT is returned if a booking was added while the removal was in flight","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/bookings":{"post":{"tags":["Bookings"],"summary":"Create a booking","description":"An optional Idempotency-Key is scoped to the customer. Retrying the same key and body replays the original booking without creating or notifying again. Reusing the key for another station, vehicle, date or time returns 409 IDEMPOTENCY_KEY_REUSED.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{8,128}$"},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"stationId":{"type":"string","minLength":1},"vehicleId":{"type":"string","minLength":1},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"timeSlot":{"type":"string","pattern":"^\\d{2}:\\d{2}$"}},"required":["stationId","vehicleId","date"]}}}},"responses":{"200":{"description":"Original booking replayed for the same key and body","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt"]}},"required":["data"]}}}},"201":{"description":"Booking created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt"]}},"required":["data"]}}}},"400":{"description":"Invalid body or Idempotency-Key (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Key already used for a different booking (IDEMPOTENCY_KEY_REUSED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/bookings/mine":{"get":{"tags":["Bookings"],"summary":"List my bookings","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Filter by one status, comma-separated statuses, or repeated status parameters."},"required":false,"description":"Filter by one status, comma-separated statuses, or repeated status parameters.","name":"status","in":"query"}],"responses":{"200":{"description":"Paginated bookings","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}}}}},"/api/v1/bookings/{id}":{"get":{"tags":["Bookings"],"summary":"Read the signed-in customer’s booking","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Booking detail with station address and nullable customer identity","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"stationAddress":{"type":"string"},"stationSuburb":{"type":"string"},"stationState":{"type":"string"},"stationPostcode":{"type":"string"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","stationAddress","stationSuburb","stationState","stationPostcode"]}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Booking not found for this customer (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Bookings"],"summary":"Cancel a booking","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Booking cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt"]}},"required":["data"]}}}},"409":{"description":"Booking changed concurrently (BOOKING_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/bookings/{id}/cancel":{"post":{"tags":["Bookings"],"summary":"Cancel a booking, optionally with a reason","description":"The body is optional. `reason` is trimmed and every whitespace run collapsed to one space, and is measured after that: at most 200 characters. A blank or whitespace-only reason means no reason. Unknown keys are rejected. DELETE /api/v1/bookings/{id} stays for shipped app builds and records no reason. Both record cancelledBy CUSTOMER.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":200}},"additionalProperties":false}}}},"responses":{"200":{"description":"Booking cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt"]}},"required":["data"]}}}},"400":{"description":"Validation error (VALIDATION_ERROR): reason too long, unknown key, or the booking cannot be cancelled in its current status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"The booking belongs to another customer (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Booking not found (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Booking changed concurrently (BOOKING_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/claim":{"post":{"tags":["Station Portal"],"summary":"Claim a station","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"stationId":{"type":"string"}},"required":["stationId"]}}}},"responses":{"201":{"description":"Station claimed","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"stationUserId":{"type":"string"}},"required":["stationUserId"]}},"required":["data"]}}}}}}},"/api/v1/station/profile":{"get":{"tags":["Station Portal"],"summary":"Get station profile","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Station profile","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"address":{"type":"string"},"suburb":{"type":"string"},"postcode":{"type":"string"},"state":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"},"phone":{"type":["string","null"]},"accreditations":{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]}},"isActive":{"type":"boolean"},"isPremium":{"type":"boolean"},"distanceKm":{"type":"number"},"googleRating":{"type":["number","null"]},"googleReviewCount":{"type":["number","null"]},"heroImageUrl":{"type":["string","null"]},"bookable":{"type":"boolean"},"nextFree":{"type":["string","null"],"format":"date-time"},"timezone":{"type":"string"},"email":{"type":["string","null"]},"website":{"type":["string","null"]},"description":{"type":["string","null"]},"openingHours":{"type":["object","null"],"additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]}]}},"googlePlaceId":{"type":["string","null"]},"googleMapsUri":{"type":["string","null"]},"businessStatus":{"type":["string","null"]},"enrichment":{"type":["object","null"],"properties":{"photos":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"widthPx":{"type":"number"},"heightPx":{"type":"number"}},"required":["url","widthPx","heightPx"]}},"googleReviews":{"type":"array","items":{"type":"object","properties":{"author":{"type":["string","null"]},"rating":{"type":["number","null"]},"text":{"type":["string","null"]},"publishTime":{"type":["string","null"]}},"required":["author","rating","text","publishTime"]}},"socialLinks":{"type":"object","properties":{"facebook":{"type":"string"},"instagram":{"type":"string"},"twitter":{"type":"string"},"tiktok":{"type":"string"},"youtube":{"type":"string"},"linkedin":{"type":"string"}}},"googleOpeningHours":{"type":"array","items":{"type":"string"}}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"bookableBlockers":{"type":"array","items":{"type":"string","enum":["VERIFICATION","HOURS","BILLING"]},"description":"Why the station is not Bookable: VERIFICATION, HOURS and/or BILLING. Empty when Bookable."}},"required":["id","name","slug","address","suburb","postcode","state","latitude","longitude","phone","accreditations","isActive","isPremium","googleRating","googleReviewCount","heroImageUrl","bookable","timezone","email","website","description","openingHours","googlePlaceId","googleMapsUri","businessStatus","enrichment","createdAt","updatedAt","bookableBlockers"]}},"required":["data"]}}}}}},"put":{"tags":["Station Portal"],"summary":"Update station profile","description":"Owner only; the station must be VERIFIED. `heroImageUrl` sets the listing photo: null removes it; otherwise it must be one of this station's own uploads (POST /api/v1/station/photo), the photo enrichment gives the station today, or the current `heroImageUrl` unchanged.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"phone":{"type":"string","maxLength":20},"email":{"type":"string","format":"email"},"website":{"type":"string","format":"uri"},"description":{"type":"string","maxLength":2000},"heroImageUrl":{"type":["string","null"],"maxLength":2048,"format":"uri"},"openingHours":{"type":"object","properties":{"monday":{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]},"tuesday":{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]},"wednesday":{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]},"thursday":{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]},"friday":{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]},"saturday":{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]},"sunday":{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]}}}}}}}},"responses":{"200":{"description":"Updated station","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"address":{"type":"string"},"suburb":{"type":"string"},"postcode":{"type":"string"},"state":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"},"phone":{"type":["string","null"]},"accreditations":{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]}},"isActive":{"type":"boolean"},"isPremium":{"type":"boolean"},"distanceKm":{"type":"number"},"googleRating":{"type":["number","null"]},"googleReviewCount":{"type":["number","null"]},"heroImageUrl":{"type":["string","null"]},"bookable":{"type":"boolean"},"nextFree":{"type":["string","null"],"format":"date-time"},"timezone":{"type":"string"},"email":{"type":["string","null"]},"website":{"type":["string","null"]},"description":{"type":["string","null"]},"openingHours":{"type":["object","null"],"additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]}]}},"googlePlaceId":{"type":["string","null"]},"googleMapsUri":{"type":["string","null"]},"businessStatus":{"type":["string","null"]},"enrichment":{"type":["object","null"],"properties":{"photos":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"widthPx":{"type":"number"},"heightPx":{"type":"number"}},"required":["url","widthPx","heightPx"]}},"googleReviews":{"type":"array","items":{"type":"object","properties":{"author":{"type":["string","null"]},"rating":{"type":["number","null"]},"text":{"type":["string","null"]},"publishTime":{"type":["string","null"]}},"required":["author","rating","text","publishTime"]}},"socialLinks":{"type":"object","properties":{"facebook":{"type":"string"},"instagram":{"type":"string"},"twitter":{"type":"string"},"tiktok":{"type":"string"},"youtube":{"type":"string"},"linkedin":{"type":"string"}}},"googleOpeningHours":{"type":"array","items":{"type":"string"}}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"bookableBlockers":{"type":"array","items":{"type":"string","enum":["VERIFICATION","HOURS","BILLING"]},"description":"Why the station is not Bookable: VERIFICATION, HOURS and/or BILLING. Empty when Bookable."}},"required":["id","name","slug","address","suburb","postcode","state","latitude","longitude","phone","accreditations","isActive","isPremium","googleRating","googleReviewCount","heroImageUrl","bookable","timezone","email","website","description","openingHours","googlePlaceId","googleMapsUri","businessStatus","enrichment","createdAt","updatedAt","bookableBlockers"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid body, or a heroImageUrl that is not one of the station's photos (Choose a photo you uploaded)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/verification":{"get":{"tags":["Station Portal"],"summary":"Get the signed-in station's own verification record (incl. decision note)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Owner-facing verification record","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"verificationStatus":{"type":"string","enum":["UNVERIFIED","PENDING","VERIFIED","REJECTED","REVOKED"]},"decisionNote":{"type":["string","null"]},"abn":{"type":["string","null"]},"aisLicenceNumber":{"type":["string","null"]},"evidence":{"type":["object","null"],"additionalProperties":{}},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"verifiedAt":{"type":["string","null"]},"revokedAt":{"type":["string","null"]}},"required":["verificationStatus","decisionNote","abn","aisLicenceNumber","evidence","submittedAt","reviewedAt","verifiedAt","revokedAt"]}},"required":["data"]}}}},"404":{"description":"Station not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/day-policies":{"get":{"tags":["Station Portal"],"summary":"Get the station's per-weekday selling rules","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Weekday policies and the Regulated Fee Cap","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"dayOfWeek":{"type":"integer","minimum":0,"maximum":6},"open":{"type":["string","null"]},"close":{"type":["string","null"]},"mode":{"type":"string","enum":["SLOT","DAY"]},"slotMinutes":{"type":["integer","null"]},"bays":{"type":"integer"},"paymentTiming":{"type":"string","enum":["AT_STATION","PREPAY_OPTIONAL","PREPAY_REQUIRED"]},"inspectionPriceCents":{"type":["integer","null"]},"prepaidInspectionPriceCents":{"type":["integer","null"]},"calloutFeeCents":{"type":["integer","null"]}},"required":["dayOfWeek","open","close","mode","slotMinutes","bays","paymentTiming","inspectionPriceCents","prepaidInspectionPriceCents","calloutFeeCents"]}},"meta":{"type":"object","properties":{"regulatedInspectionFeeCapCents":{"type":["integer","null"],"minimum":0,"description":"NSW Regulated Fee Cap in cents, or null when no cap is configured."}},"required":["regulatedInspectionFeeCapCents"]}},"required":["data","meta"]}}}}}},"put":{"tags":["Station Portal"],"summary":"Replace all seven weekday policies","description":"Owner only. Premium gating, prepay availability, callout eligibility and the Regulated Fee Cap are enforced.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"policies":{"type":"array","items":{"type":"object","properties":{"dayOfWeek":{"type":"integer","minimum":0,"maximum":6},"open":{"type":["string","null"],"pattern":"^\\d{2}:\\d{2}$"},"close":{"type":["string","null"],"pattern":"^\\d{2}:\\d{2}$"},"mode":{"type":"string","enum":["SLOT","DAY"],"default":"SLOT"},"slotMinutes":{"type":["integer","null"],"minimum":15,"maximum":240},"bays":{"type":"integer","minimum":1,"maximum":20,"default":1},"paymentTiming":{"type":"string","enum":["AT_STATION","PREPAY_OPTIONAL","PREPAY_REQUIRED"],"default":"AT_STATION"},"inspectionPriceCents":{"type":["integer","null"],"minimum":0,"maximum":100000},"prepaidInspectionPriceCents":{"type":["integer","null"],"minimum":0,"maximum":100000},"calloutFeeCents":{"type":["integer","null"],"minimum":0,"maximum":100000}},"required":["dayOfWeek","open","close"]}}},"required":["policies"]}}}},"responses":{"200":{"description":"Saved weekday policies and the Regulated Fee Cap","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"dayOfWeek":{"type":"integer","minimum":0,"maximum":6},"open":{"type":["string","null"]},"close":{"type":["string","null"]},"mode":{"type":"string","enum":["SLOT","DAY"]},"slotMinutes":{"type":["integer","null"]},"bays":{"type":"integer"},"paymentTiming":{"type":"string","enum":["AT_STATION","PREPAY_OPTIONAL","PREPAY_REQUIRED"]},"inspectionPriceCents":{"type":["integer","null"]},"prepaidInspectionPriceCents":{"type":["integer","null"]},"calloutFeeCents":{"type":["integer","null"]}},"required":["dayOfWeek","open","close","mode","slotMinutes","bays","paymentTiming","inspectionPriceCents","prepaidInspectionPriceCents","calloutFeeCents"]}},"meta":{"type":"object","properties":{"regulatedInspectionFeeCapCents":{"type":["integer","null"],"minimum":0,"description":"NSW Regulated Fee Cap in cents, or null when no cap is configured."}},"required":["regulatedInspectionFeeCapCents"]}},"required":["data","meta"]}}}},"400":{"description":"VALIDATION_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/subscription":{"get":{"tags":["Station Portal"],"summary":"Get the station's subscription","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Current subscription","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"productId":{"type":"string"},"productName":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","PAST_DUE","CANCELLED","TRIALING","PAUSED"]},"currentPeriodEnd":{"type":"string"},"graceUntil":{"type":["string","null"],"format":"date-time","description":"ISO 8601 grace deadline; non-null only while status is PAST_DUE."},"createdAt":{"type":"string"}},"required":["id","stationId","productId","productName","status","currentPeriodEnd","graceUntil","createdAt"]}},"required":["data"]}}}},"404":{"description":"Subscription not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/photo":{"post":{"tags":["Station Portal"],"summary":"Upload the listing photo","description":"Owner only; the station must be VERIFIED. Decodes a base64 JPEG, PNG, WebP, GIF or AVIF image (at most 10 MiB, 40 megapixels; SVG and animated images are refused), strips metadata and stores WebP copies under the station's own stations/<id>/hero/ prefix on the CDN. The photo is not live until it is saved as `heroImageUrl` with PUT /api/v1/station/profile.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"base64":{"type":"string","minLength":1,"maxLength":10485760}},"required":["base64"]}}}},"responses":{"201":{"description":"Photo stored; served from the CloudFront CDN","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"HTTPS CloudFront (CDN) URL of the stored WebP. Never a raw S3 URL.","example":"https://images.getmypinkslip.com.au/stations/clx2k9q8w0000abcd1234efgh/hero/3f0c2a6e-9b1d-4c1e-8f53-0d2b7a9e4c11.webp"},"variants":{"type":"object","properties":{"1280w":{"type":"string","format":"uri"},"1024w":{"type":"string","format":"uri"},"768w":{"type":"string","format":"uri"}},"required":["1280w","1024w","768w"],"description":"HTTPS CDN URLs of the responsive WebP variants"},"width":{"type":"integer","description":"Output width in pixels"},"height":{"type":"integer","description":"Output height in pixels"}},"required":["url","variants","width","height"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: missing or non-base64 `base64`, a file that isn't a photo we can use (not an image, SVG, corrupt), animated, empty or over the size or pixel cap","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid Clerk session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: not the station owner; STATION_NOT_VERIFIED: station not verified","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: station not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"PAYLOAD_TOO_LARGE: request body over the JSON body limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: too many photo uploads","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"PHOTO_UPLOADS_UNAVAILABLE: uploads are not configured here (no bucket or CDN domain)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings":{"get":{"tags":["Station Portal"],"summary":"List station bookings (marketplace + own-work diary entries)","description":"Own-work diary entries (source = STATION) are collapsed to one row per jobGroupId with every occupied slot in timeSlots; their customer/vehicle fields are null. A block (isBlock true) is one row too, listing each slot once; blockBays is its bays per slot, or places on a day-booking day, and null on every other row. meta.total counts collapsed units.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":false,"name":"date","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Paginated bookings with customer or walk-in details","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"},"timeSlots":{"type":"array","items":{"type":["string","null"]}},"durationSlots":{"type":"number"},"blockBays":{"type":["number","null"]}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock","timeSlots","durationSlots","blockBays"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}}}}},"/api/v1/station/bookings/{id}":{"get":{"tags":["Station Portal"],"summary":"Get a booking belonging to the station","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Booking with customer or walk-in details and occupied slots","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"},"timeSlots":{"type":"array","items":{"type":["string","null"]}},"durationSlots":{"type":"number"},"blockBays":{"type":["number","null"]}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock","timeSlots","durationSlots","blockBays"]}},"required":["data"]}}}},"403":{"description":"Booking belongs to another station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Booking not found (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{id}/events":{"get":{"tags":["Station Portal"],"summary":"Get a booking's History (event log)","description":"Oldest first: the booking's own events, those of the bookings it was rescheduled from, and its diary job's or block's group. Never carries a user id or the customer's identity.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The booking events, oldest first","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BookingEventItem"}}},"required":["data"]}}}},"404":{"description":"Booking not found, or another station's booking (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/customers":{"get":{"tags":["Station Portal"],"summary":"Search the station customer directory","description":"Only identities from this station’s bookings; grouped diary jobs count once.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","maxLength":100},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":1000000,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Paginated customer and walk-in summaries","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"customerKey":{"type":"string"},"kind":{"type":"string","enum":["CUSTOMER","WALK_IN"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"lastVisitAt":{"type":["string","null"]},"bookingCount":{"type":"integer"}},"required":["customerKey","kind","name","phone","lastVisitAt","bookingCount"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"},"perPage":{"type":"number"}},"required":["page","total","totalPages","perPage"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid query (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Caller has no station association or insufficient station permissions (FORBIDDEN), or the signed-in identity is a test identity (TEST_IDENTITY_NOT_ALLOWED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/customers/match":{"get":{"tags":["Station Portal"],"summary":"Match an Australian mobile within the station customer directory","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","maxLength":100},"required":true,"name":"mobile","in":"query"}],"responses":{"200":{"description":"Matching customer and station-scoped cars, or null","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":["object","null"],"properties":{"customerKey":{"type":"string"},"kind":{"type":"string","enum":["CUSTOMER","WALK_IN"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"lastVisitAt":{"type":["string","null"]},"bookingCount":{"type":"integer"},"cars":{"type":"array","items":{"type":"object","properties":{"vehicleId":{"type":["string","null"]},"rego":{"type":"string"},"regoState":{"type":["string","null"]},"make":{"type":["string","null"]},"model":{"type":["string","null"]}},"required":["vehicleId","rego","regoState","make","model"]}}},"required":["customerKey","kind","name","phone","lastVisitAt","bookingCount","cars"]}},"required":["data"]}}}},"400":{"description":"Invalid Australian mobile (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Caller has no station association or insufficient station permissions (FORBIDDEN), or the signed-in identity is a test identity (TEST_IDENTITY_NOT_ALLOWED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/customers/{customerKey}":{"get":{"tags":["Station Portal"],"summary":"Read a station customer and their booking history","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^(c_[a-zA-Z0-9_-]{1,128}|w_[a-f0-9]{32})$"},"required":true,"name":"customerKey","in":"path"},{"schema":{"type":"string","maxLength":100},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":1000000,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Customer, station-scoped cars and paginated booking history","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"customerKey":{"type":"string"},"kind":{"type":"string","enum":["CUSTOMER","WALK_IN"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"lastVisitAt":{"type":["string","null"]},"bookingCount":{"type":"integer"},"cars":{"type":"array","items":{"type":"object","properties":{"vehicleId":{"type":["string","null"]},"rego":{"type":"string"},"regoState":{"type":["string","null"]},"make":{"type":["string","null"]},"model":{"type":["string","null"]}},"required":["vehicleId","rego","regoState","make","model"]}},"bookings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"status":{"type":"string","enum":["PENDING","CONFIRMED","CHECKED_IN","COMPLETED","CANCELLED","NO_SHOW"]},"inspectionResult":{"type":["string","null"],"enum":["PASS","FAIL",null]},"notes":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"vehicleId":{"type":["string","null"]},"rego":{"type":["string","null"]}},"required":["id","date","timeSlot","bookedMode","source","status","inspectionResult","notes","jobGroupId","vehicleId","rego"]}},"bookingsMeta":{"type":"object","properties":{"page":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"},"perPage":{"type":"number"}},"required":["page","total","totalPages","perPage"]}},"required":["customerKey","kind","name","phone","lastVisitAt","bookingCount","cars","bookings","bookingsMeta"]}},"required":["data"]}}}},"400":{"description":"Invalid customer key or query (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Caller has no station association or insufficient station permissions (FORBIDDEN), or the signed-in identity is a test identity (TEST_IDENTITY_NOT_ALLOWED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No customer at this station matches the key (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/diary":{"post":{"tags":["Station Portal"],"summary":"Add an own-work diary job (premium only)","description":"Creates one CONFIRMED booking row per 30-min slot, all sharing a jobGroupId, in a single transaction — if any slot is taken the whole job fails with a slot-not-available error. Non-premium stations receive 403 PREMIUM_REQUIRED. Diary entries never trigger notifications or reminders.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"timeSlot":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"durationSlots":{"type":"integer","minimum":1,"maximum":16,"default":1},"title":{"type":"string","minLength":1,"maxLength":200},"walkInName":{"type":"string","maxLength":200},"walkInPhone":{"type":"string","maxLength":40},"walkInRego":{"type":"string","maxLength":20},"notes":{"type":"string","maxLength":2000}},"required":["date","timeSlot","title"]}}}},"responses":{"201":{"description":"Created diary job","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"jobGroupId":{"type":"string"},"stationId":{"type":"string"},"date":{"type":"string"},"timeSlots":{"type":"array","items":{"type":"string"}},"durationSlots":{"type":"number"},"status":{"type":"string"},"title":{"type":"string"},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"notes":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"bookingIds":{"type":"array","items":{"type":"string"}}},"required":["jobGroupId","stationId","date","timeSlots","durationSlots","status","title","walkInName","walkInPhone","walkInRego","notes","createdAt","updatedAt","bookingIds"]}},"required":["data"]}}}},"403":{"description":"Station is not premium (code: PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/diary/{jobGroupId}":{"patch":{"tags":["Station Portal"],"summary":"Edit a diary job (freetext fields only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"jobGroupId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"walkInName":{"type":["string","null"],"maxLength":200},"walkInPhone":{"type":["string","null"],"maxLength":40},"walkInRego":{"type":["string","null"],"maxLength":20},"notes":{"type":["string","null"],"maxLength":2000}}}}}},"responses":{"200":{"description":"Updated diary job","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"jobGroupId":{"type":"string"},"stationId":{"type":"string"},"date":{"type":"string"},"timeSlots":{"type":"array","items":{"type":"string"}},"durationSlots":{"type":"number"},"status":{"type":"string"},"title":{"type":"string"},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"notes":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"bookingIds":{"type":"array","items":{"type":"string"}}},"required":["jobGroupId","stationId","date","timeSlots","durationSlots","status","title","walkInName","walkInPhone","walkInRego","notes","createdAt","updatedAt","bookingIds"]}},"required":["data"]}}}}}},"delete":{"tags":["Station Portal"],"summary":"Cancel a diary job, freeing its slots","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"jobGroupId","in":"path"}],"responses":{"200":{"description":"Cancelled diary job","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"jobGroupId":{"type":"string"},"stationId":{"type":"string"},"date":{"type":"string"},"timeSlots":{"type":"array","items":{"type":"string"}},"durationSlots":{"type":"number"},"status":{"type":"string"},"title":{"type":"string"},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"notes":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"bookingIds":{"type":"array","items":{"type":"string"}}},"required":["jobGroupId","stationId","date","timeSlots","durationSlots","status","title","walkInName","walkInPhone","walkInRego","notes","createdAt","updatedAt","bookingIds"]}},"required":["data"]}}}}}}},"/api/v1/station/diary/{jobGroupId}/complete":{"post":{"tags":["Station Portal"],"summary":"Mark a diary job as completed","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"jobGroupId","in":"path"}],"responses":{"200":{"description":"Completed diary job","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"jobGroupId":{"type":"string"},"stationId":{"type":"string"},"date":{"type":"string"},"timeSlots":{"type":"array","items":{"type":"string"}},"durationSlots":{"type":"number"},"status":{"type":"string"},"title":{"type":"string"},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"notes":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"bookingIds":{"type":"array","items":{"type":"string"}}},"required":["jobGroupId","stationId","date","timeSlots","durationSlots","status","title","walkInName","walkInPhone","walkInRego","notes","createdAt","updatedAt","bookingIds"]}},"required":["data"]}}}}}}},"/api/v1/station/blocks":{"post":{"tags":["Station Portal"],"summary":"Block a slot, or hold places on a day-booking day","description":"Any plan. On a SLOT day, blocks `bays` bays of each slot from `timeSlot` for `durationSlots` slots; on a DAY day, holds `bays` places (send no `timeSlot`). Writes one CONFIRMED STATION booking row per bay per slot, or per place, sharing a blockId, in a single transaction, and only blocks what is free: otherwise 400 \"Time slot is not available\". Drivers see a blocked place as taken, like a booked one. Nobody is notified.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","format":"date"},"timeSlot":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"durationSlots":{"type":"integer","minimum":1,"maximum":16,"default":1},"bays":{"type":"integer","minimum":1,"maximum":20,"default":1},"reason":{"type":"string","maxLength":200}},"required":["date"]}}}},"responses":{"201":{"description":"Created block","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"blockId":{"type":"string"},"stationId":{"type":"string"},"date":{"type":"string"},"timeSlots":{"type":"array","items":{"type":"string"}},"bays":{"type":"number"},"reason":{"type":["string","null"]},"createdAt":{"type":"string"},"bookingIds":{"type":"array","items":{"type":"string"}}},"required":["blockId","stationId","date","timeSlots","bays","reason","createdAt","bookingIds"]}},"required":["data"]}}}},"400":{"description":"Past date or time, closed day, slot off the grid, more bays than the day has, or not free","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Station not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/blocks/{blockId}":{"delete":{"tags":["Station Portal"],"summary":"Unblock, freeing every place of the block","description":"Cancels the block's open rows (cancelledBy STATION). Nobody is notified. 404 for an unknown id, another station's block or a diary job; 400 when already unblocked.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"blockId","in":"path"}],"responses":{"200":{"description":"Unblocked block","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"blockId":{"type":"string"},"stationId":{"type":"string"},"date":{"type":"string"},"timeSlots":{"type":"array","items":{"type":"string"}},"bays":{"type":"number"},"reason":{"type":["string","null"]},"createdAt":{"type":"string"},"bookingIds":{"type":"array","items":{"type":"string"}}},"required":["blockId","stationId","date","timeSlots","bays","reason","createdAt","bookingIds"]}},"required":["data"]}}}},"400":{"description":"Block is already unblocked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Block not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{id}/check-in":{"post":{"tags":["Station Portal"],"summary":"Check in a booking","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Booking checked in","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock"]}},"required":["data"]}}}},"409":{"description":"Booking changed concurrently (BOOKING_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{id}/complete":{"post":{"tags":["Station Portal"],"summary":"Complete a booking with inspection result","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"inspectionResult":{"type":"string","enum":["PASS","FAIL"]},"notes":{"type":"string","maxLength":2000}},"required":["inspectionResult"]}}}},"responses":{"200":{"description":"Booking completed","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock"]}},"required":["data"]}}}},"409":{"description":"Booking changed concurrently (BOOKING_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{id}/no-show":{"post":{"tags":["Station Portal"],"summary":"Mark a booking as no-show","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Booking marked as no-show","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock"]}},"required":["data"]}}}},"409":{"description":"Booking changed concurrently (BOOKING_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{id}/reschedule":{"post":{"tags":["Station Portal"],"summary":"Reschedule a booking","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"timeSlot":{"type":"string","pattern":"^\\d{2}:\\d{2}$"}},"required":["date"]}}}},"responses":{"200":{"description":"New booking created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock"]}},"required":["data"]}}}},"409":{"description":"Customer deleted their account (BOOKING_CUSTOMER_DELETED), or booking changed concurrently (BOOKING_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{id}/cancel":{"post":{"tags":["Station Portal"],"summary":"Cancel a booking on behalf of the station","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000}}}}}},"responses":{"200":{"description":"Cancelled booking; the customer is notified","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock"]}},"required":["data"]}}}},"400":{"description":"Invalid body, station diary entry, or booking not in a cancellable status (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Booking belongs to another station, or caller lacks station access (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Booking not found (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Customer deleted their account (BOOKING_CUSTOMER_DELETED), or booking changed concurrently (BOOKING_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{id}/message":{"post":{"tags":["Station Portal"],"summary":"Send a completion SMS to the booking’s customer","description":"Only for a COMPLETED booking with a customer, using an approved template. delivered is false, with no error, and a reason, when the SMS was not sent: customer_not_found, opted_out, no_phone, sms_not_configured, insufficient_credits or send_failed.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"type":"string","minLength":1}},"required":["templateId"]}}}},"responses":{"200":{"description":"SMS send result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"delivered":{"type":"boolean"},"messageId":{"type":"string"},"reason":{"type":"string","enum":["customer_not_found","opted_out","no_phone","sms_not_configured","insufficient_credits","send_failed"],"description":"Why delivered is false: the customer no longer exists, opted out of SMS, has no phone, the station has no SMS provider configured, the station is out of SMS credits, or the provider failed to send"}},"required":["delivered"]}},"required":["data"]}}}},"400":{"description":"Invalid body, booking not completed, no customer to message, or rendered message too long (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Booking or template not found (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Customer deleted their account (BOOKING_CUSTOMER_DELETED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/billing-profile":{"get":{"tags":["Station Portal"],"summary":"Get the station's billing profile (premium only)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Billing profile","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"legalName":{"type":"string"},"abn":{"type":["string","null"],"description":"From the Station's verification; never entered on the profile"},"gstRegistered":{"type":"boolean"},"billingAddress":{"type":"string"},"paymentInstructions":{"type":["string","null"]},"footer":{"type":["string","null"]},"nextInvoiceNumber":{"type":"integer"},"invoicePrefix":{"type":["string","null"]},"maxStaffDiscountBps":{"type":["integer","null"],"minimum":0,"maximum":10000,"description":"0-10000 basis points; null means STAFF discounts have no limit"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","stationId","legalName","abn","gstRegistered","billingAddress","paymentInstructions","footer","nextInvoiceNumber","invoicePrefix","maxStaffDiscountBps","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"The station has no billing profile yet (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["Station Portal"],"summary":"Replace the station's billing profile (owner, premium only)","description":"Omitted optional fields are cleared. The ABN is not accepted: it comes from the station verification, and a GST-registered profile needs a verified ABN.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"legalName":{"type":"string","minLength":1,"maxLength":200},"gstRegistered":{"type":"boolean"},"billingAddress":{"type":"string","minLength":1,"maxLength":500},"paymentInstructions":{"type":["string","null"],"minLength":1,"maxLength":2000},"footer":{"type":["string","null"],"minLength":1,"maxLength":2000},"invoicePrefix":{"type":["string","null"],"minLength":1,"maxLength":20},"maxStaffDiscountBps":{"type":["integer","null"],"minimum":0,"maximum":10000}},"required":["legalName","gstRegistered","billingAddress"],"additionalProperties":false}}}},"responses":{"200":{"description":"Saved billing profile","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"legalName":{"type":"string"},"abn":{"type":["string","null"],"description":"From the Station's verification; never entered on the profile"},"gstRegistered":{"type":"boolean"},"billingAddress":{"type":"string"},"paymentInstructions":{"type":["string","null"]},"footer":{"type":["string","null"]},"nextInvoiceNumber":{"type":"integer"},"invoicePrefix":{"type":["string","null"]},"maxStaffDiscountBps":{"type":["integer","null"],"minimum":0,"maximum":10000,"description":"0-10000 basis points; null means STAFF discounts have no limit"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","stationId","legalName","abn","gstRegistered","billingAddress","paymentInstructions","footer","nextInvoiceNumber","invoicePrefix","maxStaffDiscountBps","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"]}}}},"400":{"description":"Invalid body, including an abn field or maxStaffDiscountBps outside 0-10000, or gstRegistered without a verified station ABN (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a station OWNER (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/catalogue":{"get":{"tags":["Station Portal"],"summary":"List the station's catalogue items (premium only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["PART","LABOUR","CONSUMABLE","FEE"]},"required":false,"name":"kind","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"active","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":100},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"perPage","in":"query"}],"responses":{"200":{"description":"Paginated catalogue items","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"kind":{"type":"string","enum":["PART","LABOUR","CONSUMABLE","FEE"]},"code":{"type":["string","null"]},"name":{"type":"string"},"unit":{"type":"string"},"unitPriceExCents":{"type":"integer","description":"Default price, ex-GST cents"},"costExCents":{"type":["integer","null"]},"taxable":{"type":"boolean"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","stationId","kind","code","name","unit","unitPriceExCents","costExCents","taxable","active","createdAt","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"page":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"},"perPage":{"type":"number"}},"required":["page","total","totalPages","perPage"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Station Portal"],"summary":"Add a catalogue item (premium only)","description":"Prices are ex-GST integer cents.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["PART","LABOUR","CONSUMABLE","FEE"]},"code":{"type":["string","null"],"minLength":1,"maxLength":40},"name":{"type":"string","minLength":1,"maxLength":200},"unit":{"type":"string","minLength":1,"maxLength":20,"default":"each"},"unitPriceExCents":{"type":"integer","minimum":0,"maximum":99999999},"costExCents":{"type":["integer","null"],"minimum":0,"maximum":99999999},"taxable":{"type":"boolean","default":true}},"required":["kind","name","unitPriceExCents"]}}}},"responses":{"201":{"description":"Created catalogue item","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"kind":{"type":"string","enum":["PART","LABOUR","CONSUMABLE","FEE"]},"code":{"type":["string","null"]},"name":{"type":"string"},"unit":{"type":"string"},"unitPriceExCents":{"type":"integer","description":"Default price, ex-GST cents"},"costExCents":{"type":["integer","null"]},"taxable":{"type":"boolean"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","stationId","kind","code","name","unit","unitPriceExCents","costExCents","taxable","active","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Another catalogue item at the station already uses this code (CATALOGUE_CODE_TAKEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/catalogue/{id}":{"patch":{"tags":["Station Portal"],"summary":"Update a catalogue item (premium only)","description":"A partial update. Changing unitPriceExCents requires reasonCode (and reasonText for OTHER; FIRST_PRICE is never valid here) and records a Price Change against the signed-in user. It never re-prices existing Job Lines.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["PART","LABOUR","CONSUMABLE","FEE"]},"code":{"type":["string","null"],"minLength":1,"maxLength":40},"name":{"type":"string","minLength":1,"maxLength":200},"unit":{"type":"string","minLength":1,"maxLength":20},"unitPriceExCents":{"type":"integer","minimum":0,"maximum":99999999},"costExCents":{"type":["integer","null"],"minimum":0,"maximum":99999999},"taxable":{"type":"boolean"},"active":{"type":"boolean"},"reasonCode":{"type":"string","enum":["PRICE_MATCH","GOODWILL","TRADE_RATE","WRONG_PRICE","SUPPLIER_PRICE_CHANGE","FIRST_PRICE","OTHER"]},"reasonText":{"type":["string","null"],"minLength":1,"maxLength":500}}}}}},"responses":{"200":{"description":"Updated catalogue item","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"kind":{"type":"string","enum":["PART","LABOUR","CONSUMABLE","FEE"]},"code":{"type":["string","null"]},"name":{"type":"string"},"unit":{"type":"string"},"unitPriceExCents":{"type":"integer","description":"Default price, ex-GST cents"},"costExCents":{"type":["integer","null"]},"taxable":{"type":"boolean"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","stationId","kind","code","name","unit","unitPriceExCents","costExCents","taxable","active","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No catalogue item with this id at the station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Another catalogue item at the station already uses this code (CATALOGUE_CODE_TAKEN), or the price was changed by a concurrent request (CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/catalogue/{id}/deactivate":{"post":{"tags":["Station Portal"],"summary":"Deactivate a catalogue item (premium only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deactivated catalogue item","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"kind":{"type":"string","enum":["PART","LABOUR","CONSUMABLE","FEE"]},"code":{"type":["string","null"]},"name":{"type":"string"},"unit":{"type":"string"},"unitPriceExCents":{"type":"integer","description":"Default price, ex-GST cents"},"costExCents":{"type":["integer","null"]},"taxable":{"type":"boolean"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","stationId","kind","code","name","unit","unitPriceExCents","costExCents","taxable","active","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No catalogue item with this id at the station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/catalogue/{id}/price-changes":{"get":{"tags":["Station Portal"],"summary":"List a catalogue item's price changes (premium only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Append-only price change audit for the item","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"subjectType":{"type":"string","enum":["JOB_LINE","CATALOGUE_ITEM"]},"subjectId":{"type":"string"},"basis":{"type":"string","enum":["INC","EX"]},"oldCents":{"type":["integer","null"],"description":"Null only with FIRST_PRICE"},"newCents":{"type":"integer"},"reasonCode":{"type":"string","enum":["PRICE_MATCH","GOODWILL","TRADE_RATE","WRONG_PRICE","SUPPLIER_PRICE_CHANGE","FIRST_PRICE","OTHER"]},"reasonText":{"type":["string","null"]},"changedByClerkUserId":{"type":"string"},"changedAt":{"type":"string","format":"date-time"}},"required":["id","stationId","subjectType","subjectId","basis","oldCents","newCents","reasonCode","reasonText","changedByClerkUserId","changedAt"],"additionalProperties":false}}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No catalogue item with this id at the station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{bookingId}/job":{"get":{"tags":["Station Portal"],"summary":"Get a booking's Job","description":"Station OWNER or STAFF. Not premium-gated: an existing Job stays readable when the subscription lapses.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"bookingId","in":"path"}],"responses":{"200":{"description":"The Job, or null when the booking has no Job yet","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#/components/schemas/Job"},{"type":["object","null"]}]}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, Job, line or catalogue item in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{bookingId}/job/lines":{"post":{"tags":["Station Portal"],"summary":"Add a Job Line to a booking (premium only)","description":"Station OWNER or STAFF. Premium only. Job Line prices are GST-inclusive integer cents. The first line added creates the Job; a customer booking's Job starts with its INSPECTION line. Add from the catalogue (catalogueItemId), as an INSPECTION line, or ad hoc (a catalogue kind with description and unitPriceCents).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"bookingId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"catalogueItemId":{"type":"string","minLength":1},"kind":{"type":"string","enum":["INSPECTION","LABOUR","PART","CONSUMABLE","FEE"]},"description":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"number","minimum":0.001,"maximum":99999,"default":1},"unitPriceCents":{"type":"integer","minimum":0,"maximum":99999999},"taxable":{"type":"boolean"}}}}}},"responses":{"201":{"description":"The Job including the new line","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Job"}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, Job, line or catalogue item in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"A concurrent request was creating the Job; retry (CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{bookingId}/job/lines/{lineId}":{"patch":{"tags":["Station Portal"],"summary":"Update a Job Line (premium only)","description":"Station OWNER or STAFF. Premium only. Job Line prices are GST-inclusive integer cents. A partial update. Changing unitPriceCents needs reasonCode (and reasonText for OTHER) and records a Price Change. STAFF are held to the Billing Profile's discount threshold.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"bookingId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"lineId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"number","minimum":0.001,"maximum":99999},"unitPriceCents":{"type":"integer","minimum":0,"maximum":99999999},"reasonCode":{"type":"string","enum":["PRICE_MATCH","GOODWILL","TRADE_RATE","WRONG_PRICE","SUPPLIER_PRICE_CHANGE","FIRST_PRICE","OTHER"]},"reasonText":{"type":["string","null"],"minLength":1,"maxLength":500}}}}}},"responses":{"200":{"description":"The Job including the updated line","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Job"}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), the station is not premium (PREMIUM_REQUIRED), or a STAFF price is below the Billing Profile discount floor or a STAFF first price is $0 (DISCOUNT_THRESHOLD)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, Job, line or catalogue item in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The price was changed by a concurrent request (CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Station Portal"],"summary":"Delete a Job Line (premium only)","description":"Station OWNER or STAFF. Premium only. Job Line prices are GST-inclusive integer cents.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"bookingId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"lineId","in":"path"}],"responses":{"200":{"description":"The Job without the deleted line","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Job"}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, Job, line or catalogue item in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{bookingId}/job/lines/{lineId}/price-changes":{"get":{"tags":["Station Portal"],"summary":"List a Job Line's price changes","description":"Station OWNER or STAFF. Not premium-gated: price history stays readable when the subscription lapses. Newest first.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"bookingId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"lineId","in":"path"}],"responses":{"200":{"description":"Append-only price change audit for the Job Line, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"subjectType":{"type":"string","enum":["JOB_LINE","CATALOGUE_ITEM"]},"subjectId":{"type":"string"},"basis":{"type":"string","enum":["INC","EX"]},"oldCents":{"type":["integer","null"],"description":"Null only with FIRST_PRICE"},"newCents":{"type":"integer"},"reasonCode":{"type":"string","enum":["PRICE_MATCH","GOODWILL","TRADE_RATE","WRONG_PRICE","SUPPLIER_PRICE_CHANGE","FIRST_PRICE","OTHER"]},"reasonText":{"type":["string","null"]},"changedByClerkUserId":{"type":"string"},"changedAt":{"type":"string","format":"date-time"}},"required":["id","stationId","subjectType","subjectId","basis","oldCents","newCents","reasonCode","reasonText","changedByClerkUserId","changedAt"],"additionalProperties":false}}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, Job, line or catalogue item in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{bookingId}/job/lines/order":{"put":{"tags":["Station Portal"],"summary":"Reorder a Job's lines (premium only)","description":"Station OWNER or STAFF. Premium only. Job Line prices are GST-inclusive integer cents. lineIds lists every line of the Job exactly once, in the new order.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"bookingId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"lineIds":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":500}},"required":["lineIds"]}}}},"responses":{"200":{"description":"The Job with its lines in the new order","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Job"}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, Job, line or catalogue item in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"A line was removed by a concurrent request (CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/jobs/{jobId}/special-order-parts":{"get":{"tags":["Station Portal"],"summary":"List a Job's special-order parts","description":"Station OWNER or STAFF. Not premium-gated: parts stay readable when the subscription lapses.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"jobId","in":"path"}],"responses":{"200":{"description":"The Job's special-order parts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SpecialOrderPart"}}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such Job or part in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Station Portal"],"summary":"Record a special-order part for a Job (premium only)","description":"Station OWNER or STAFF. Premium only. The part starts ORDERED. costExCents is the supplier cost in ex-GST integer cents; eta is an ISO date-time.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"jobId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"supplierName":{"type":"string","minLength":1,"maxLength":200},"supplierRef":{"type":"string","minLength":1,"maxLength":100},"costExCents":{"type":"integer","minimum":0,"maximum":99999999},"eta":{"type":"string","format":"date-time"}},"required":["description","supplierName","costExCents"],"additionalProperties":false}}}},"responses":{"201":{"description":"The recorded part","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SpecialOrderPart"}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such Job or part in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/bookings/{bookingId}/job/special-order-parts":{"post":{"tags":["Station Portal"],"summary":"Record a special-order part against a booking (premium only)","description":"Station OWNER or STAFF. Premium only. Records the part against the booking's Job, creating the Job when the booking has none (ADR 0009 §1) exactly as the first Job Line does: every slot row of the booking gets the Job, and a customer booking's Job starts with its INSPECTION line (and CALLOUT line when it has a callout fee). Same body and response as POST /station/jobs/{jobId}/special-order-parts; the part's jobId is the booking's Job.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"bookingId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"supplierName":{"type":"string","minLength":1,"maxLength":200},"supplierRef":{"type":"string","minLength":1,"maxLength":100},"costExCents":{"type":"integer","minimum":0,"maximum":99999999},"eta":{"type":"string","format":"date-time"}},"required":["description","supplierName","costExCents"],"additionalProperties":false}}}},"responses":{"201":{"description":"The recorded part; its jobId is the booking's Job","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SpecialOrderPart"}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such booking, Job, line or catalogue item in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The booking changed concurrently, for example while its Job was being created (CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/jobs/{jobId}/special-order-parts/{partId}/transition":{"post":{"tags":["Station Portal"],"summary":"Move a special-order part along its lifecycle (premium only)","description":"Station OWNER or STAFF. Premium only. The lifecycle (ADR 0009 §4): ORDERED → RECEIVED; RECEIVED → FITTED, RETURN_PENDING, KEPT_TO_STOCK or WRITTEN_OFF; RETURN_PENDING → RETURNED. Any other move answers 409 INVALID_TRANSITION. FITTED adds the part to the Job as a Job Line, at the optional unitPriceCents (GST-inclusive integer cents; allowed only with FITTED). RETURNED needs the supplier's creditNoteRef (allowed only with RETURNED). The resolver is recorded as the signed-in user, never taken from the body.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"jobId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"partId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ORDERED","RECEIVED","FITTED","RETURN_PENDING","RETURNED","KEPT_TO_STOCK","WRITTEN_OFF"]},"unitPriceCents":{"type":"integer","minimum":0,"maximum":99999999},"creditNoteRef":{"type":"string","minLength":1,"maxLength":100}},"required":["status"],"additionalProperties":false}}}},"responses":{"200":{"description":"The part in its new status","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SpecialOrderPart"}},"required":["data"]}}}},"400":{"description":"Invalid request, including RETURNED without a creditNoteRef, or a creditNoteRef or unitPriceCents with any other status (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such Job or part in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The part cannot move from its current status to the requested one (INVALID_TRANSITION), or it was changed by a concurrent request (CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/special-order-parts/return-pending":{"get":{"tags":["Station Portal"],"summary":"The station's Return pending list","description":"Station OWNER or STAFF. Not premium-gated: parts stay readable when the subscription lapses. Every RETURN_PENDING part, grouped by supplier, with its age and value, so supplier credits are not missed.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Return pending parts by supplier, with cost totals","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReturnPendingList"}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/jobs/{jobId}/invoices":{"get":{"tags":["Station Portal"],"summary":"List a Job's invoices and credit notes","description":"Station OWNER or STAFF. Not premium-gated: invoices and credit notes stay readable when the subscription lapses. Returns every draft, issued invoice and credit note for the Job, oldest first. Use GET /station/invoices/{invoiceId} for the full document.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"jobId","in":"path"}],"responses":{"200":{"description":"Invoice summaries for the Job, oldest first","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InvoiceSummary"}}},"required":["data"]}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such Job in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Station Portal"],"summary":"Start a draft invoice for a Job (premium only)","description":"Station OWNER or STAFF. Premium only. Amounts are tax-inclusive integer minor units: cents in AU, pence in GB. Payments are recorded through the invoice payments endpoints, not these ones. A draft has no number or issue date and reads its Job's lines and the current Billing Profile live; amounts and the Billing Profile are only snapshotted on issue. Lines may still be unpriced on a draft. terms defaults to DUE_ON_RECEIPT; ACCOUNT terms require a dueDate and a customer. dueDate is YYYY-MM-DD. For ACCOUNT terms the customer is either an existing customerId or, for a walk-in whose booking has no customer, a customerPhone (an Australian mobile) with optional customerFirstName, customerLastName and customerEmail: the server finds or creates the customer by that phone (attaching to a signed-up account whose verified phone matches) and bills them. customerPhone is mutually exclusive with customerId, is accepted for ACCOUNT terms only, and the name and email fields need a phone; they only fill a new or blank profile and are never echoed from an existing one. A phone-created customer counts against the same daily caps as station-created bookings (429 RATE_LIMITED) and is recorded against the signed-in user. A draft stores only terms, dueDate and customerId; it stores no billTo, which is supplied at issue. Special-order parts and unpriced lines are checked when the draft is issued, not here.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"jobId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"terms":{"type":"string","enum":["DUE_ON_RECEIPT","ACCOUNT"]},"dueDate":{"type":["string","null"],"format":"date"},"customerId":{"type":["string","null"],"minLength":1},"customerPhone":{"type":"string","minLength":6,"maxLength":20},"customerFirstName":{"type":"string","minLength":1,"maxLength":100},"customerLastName":{"type":"string","minLength":1,"maxLength":100},"customerEmail":{"type":"string","maxLength":255,"format":"email"}},"additionalProperties":false}}}},"responses":{"201":{"description":"The draft invoice","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}},"required":["data"]}}}},"400":{"description":"Invalid request, including customerPhone together with customerId, a phone on non-ACCOUNT terms, customer names or email without a phone, or a phone that is not an Australian mobile (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such Job in the caller's station, or customerId is not a customer the station has booked (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The Job already has a draft (INVOICE_DRAFT_EXISTS), already has an issued invoice that is not fully credited (JOB_ALREADY_INVOICED), has no active booking (JOB_HAS_NO_ACTIVE_BOOKING), the customer changed during creation (INVOICE_CUSTOMER_CHANGED), or a concurrent write conflicted and may be retried (INVOICE_WRITE_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"The station's or the phone's daily cap on new customers and bookings was reached, when creating a customer from customerPhone (RATE_LIMITED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/invoices/{invoiceId}":{"get":{"tags":["Station Portal"],"summary":"Get an invoice or credit note","description":"Station OWNER or STAFF. Not premium-gated: invoices and credit notes stay readable when the subscription lapses.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"invoiceId","in":"path"}],"responses":{"200":{"description":"The invoice or credit note","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such invoice in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Station Portal"],"summary":"Delete a draft invoice (premium only)","description":"Station OWNER or STAFF. Premium only. Amounts are tax-inclusive integer minor units: cents in AU, pence in GB. Payments are recorded through the invoice payments endpoints, not these ones. Only a DRAFT can be deleted; an issued invoice is corrected with a credit note.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"invoiceId","in":"path"}],"responses":{"200":{"description":"The id of the deleted draft","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or the station is not premium (PREMIUM_REQUIRED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such invoice in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The invoice is already issued and cannot be deleted (INVOICE_ISSUED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/invoices/{invoiceId}/issue":{"post":{"tags":["Station Portal"],"summary":"Issue a draft invoice (premium only; an AU tax invoice of $1,000 or more, or a GB VAT invoice over £250 names the buyer)","description":"Station OWNER or STAFF. Premium only. Amounts are tax-inclusive integer minor units: cents in AU, pence in GB. Payments are recorded through the invoice payments endpoints, not these ones. The optional body may carry freetext billTo overrides (name, phone, rego, email, abn); omitted fields default to the Job's current booking/customer, and the result is snapshotted at issue only. Assigns the next number from the station's sequence, copies the Job's lines into immutable Invoice Lines, and snapshots the bill-to details and the Billing Profile. Needs a Billing Profile and a VERIFIED station; an AU tax invoice of $1,000 or more, or a GB VAT invoice over £250 needs a bill-to name. An issued invoice is never edited.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"invoiceId","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"billTo":{"type":"object","properties":{"name":{"type":["string","null"],"minLength":1,"maxLength":200},"phone":{"type":["string","null"],"minLength":1,"maxLength":50},"rego":{"type":["string","null"],"minLength":1,"maxLength":50},"email":{"type":["string","null"],"maxLength":254,"format":"email"},"abn":{"type":["string","null"],"minLength":1,"maxLength":20}},"additionalProperties":false}},"default":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The issued invoice","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}},"required":["data"]}}}},"400":{"description":"Invalid request, including an AU tax invoice of $1,000 or more, or a GB VAT invoice over £250 without a bill-to name, or ACCOUNT terms without a customer (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), the station is not premium (PREMIUM_REQUIRED), or the station is not verified (STATION_NOT_VERIFIED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such invoice in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The invoice is not a draft or a concurrent request issued it (INVOICE_NOT_DRAFT), the Job has no lines (JOB_HAS_NO_LINES) or unpriced lines (JOB_HAS_UNPRICED_LINES), a special-order part is still ORDERED or RECEIVED (SPECIAL_ORDERS_UNDECIDED), the station has no Billing Profile (BILLING_PROFILE_REQUIRED), a GST-registered AU station has no verified ABN (ABN_REQUIRED), a VAT-registered GB Business has no VAT number (VAT_NUMBER_REQUIRED), a GB Job's INSPECTION lines total more than the highest statutory MOT fee of £124.50 (MOT_FEE_ABOVE_MAXIMUM), the Job has no active booking (JOB_HAS_NO_ACTIVE_BOOKING), the Job already has an issued invoice that is not fully credited (JOB_ALREADY_INVOICED), the customer changed during issue (INVOICE_CUSTOMER_CHANGED), a concurrent write conflicted and may be retried (INVOICE_WRITE_CONFLICT), or the number is already used (INVOICE_NUMBER_TAKEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/invoices/{invoiceId}/credit-notes":{"post":{"tags":["Station Portal"],"summary":"Credit an issued invoice (premium only)","description":"Station OWNER or STAFF. Premium only. Amounts are tax-inclusive integer minor units: cents in AU, pence in GB. Payments are recorded through the invoice payments endpoints, not these ones. Issues a Credit Note: an invoice of kind CREDIT_NOTE that references the original and carries negative lines. lines picks invoice lines and the (positive) quantity of each to credit; omit lines to credit everything that remains. A full credit lets the Job be invoiced again.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"invoiceId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"invoiceLineId":{"type":"string","minLength":1},"quantity":{"type":"number","minimum":0.001,"maximum":99999}},"required":["invoiceLineId","quantity"],"additionalProperties":false},"minItems":1,"maxItems":500},"reason":{"type":"string","maxLength":500}},"additionalProperties":false}}}},"responses":{"201":{"description":"The issued credit note","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}},"required":["data"]}}}},"400":{"description":"Invalid request, including no lines selected, an unknown or repeated invoice line, or a quantity that is not positive to 3 decimal places (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), the station is not premium (PREMIUM_REQUIRED), or the station is not verified (STATION_NOT_VERIFIED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such invoice in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The invoice is a draft or a credit note (INVOICE_NOT_CREDITABLE), it is already fully credited (INVOICE_FULLY_CREDITED), a quantity is more than the line has left to credit (CREDIT_EXCEEDS_INVOICE), the customer changed during crediting (INVOICE_CUSTOMER_CHANGED), a concurrent write conflicted and may be retried (INVOICE_WRITE_CONFLICT), or the number is already used (INVOICE_NUMBER_TAKEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/invoices/{invoiceId}/print":{"get":{"tags":["Station Portal"],"summary":"Get the A4 print data for an invoice or credit note","description":"Station OWNER or STAFF. Not premium-gated: invoices and credit notes stay readable when the subscription lapses.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"invoiceId","in":"path"}],"responses":{"200":{"description":"The document to print on A4","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InvoicePrintData"}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such invoice in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/invoices/{invoiceId}/balance":{"get":{"tags":["Station Portal"],"summary":"Get an issued invoice's balance","description":"Station OWNER or STAFF. Not premium-gated and scoped to the caller's station: the balance and payments of an issued invoice stay readable when the subscription lapses. The balance is derived on every read, never stored: the invoice total plus credit notes (negative), less payments, plus refunds, with cash rounding included. Amounts are GST-inclusive integer cents.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"invoiceId","in":"path"}],"responses":{"200":{"description":"The invoice balance and payment state","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InvoiceBalance"}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such invoice in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The invoice is a draft or a credit note and has no balance (INVOICE_NOT_PAYABLE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/invoices/{invoiceId}/payments":{"get":{"tags":["Station Portal"],"summary":"List an issued invoice's payments and refunds","description":"Station OWNER or STAFF. Not premium-gated and scoped to the caller's station: the balance and payments of an issued invoice stay readable when the subscription lapses. Payments are append-only: one is never edited or deleted, and a refund reverses it. Oldest first.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"invoiceId","in":"path"}],"responses":{"200":{"description":"The payments and refunds, oldest first","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecordedPayment"}}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such invoice in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Station Portal"],"summary":"Record a payment or refund against an issued invoice","description":"Station OWNER or STAFF. A PAYMENT is never premium-gated, so a station can always take money it is owed; a REFUND needs Premium (403 PREMIUM_REQUIRED). Amounts are integer cents and positive, with two cash exceptions: a CASH PAYMENT settling a balance of 1c or 2c has amountCents 0 (cash rounding rounds it down to $0, so roundingCents is -1 or -2 and nothing is tendered), and a CASH REFUND of 0c reverses the cash rounding once everything paid has been refunded; any other zero amount is rejected. Only an issued INVOICE can be paid, not a draft or credit note (409 INVOICE_NOT_PAYABLE). A payment cannot exceed the balance owing (409 PAYMENT_EXCEEDS_BALANCE): there is no overpayment, and a refund cannot exceed what has been paid net of earlier refunds (409 REFUND_EXCEEDS_PAID). Card payments (CARD_EXTERNAL) are taken on the station's own terminal; nothing is processed here. Cash is rounded to the nearest 5c on the settling payment only, never on a part payment: the last 1-2c round down and 3-4c round up, and the result is reported as roundingCents. tenderedCents is for a cash PAYMENT only (it must cover the amount), and the server derives changeCents. While cash rounding is outstanding, the refund that returns the last of the money must be cash and reverses the rounding, so a card or bank refund may only leave a net paid that cash can return: a whole 5c, at least 5c when there is 5c to leave, else 0c (409 REFUND_ROUNDING_NEEDS_CASH, whose message names the card-then-cash split that works). takenByClerkUserId is always the signed-in user; the body is strict and rejects unknown keys. Two concurrent payments that cannot both be applied conflict and the loser may retry (409 PAYMENT_WRITE_CONFLICT). An optional Idempotency-Key is scoped to the station and the invoice. Retrying the same key and body replays the original payment (200, no second payment is recorded or rounded). Reusing the key with a different kind, method, amountCents, reference or tenderedCents returns 409 IDEMPOTENCY_KEY_REUSED.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"invoiceId","in":"path"},{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{8,128}$"},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["PAYMENT","REFUND"]},"method":{"type":"string","enum":["CASH","CARD_EXTERNAL","BANK_TRANSFER"]},"amountCents":{"type":"integer","minimum":0,"maximum":100000000},"reference":{"type":["string","null"],"minLength":1,"maxLength":200},"tenderedCents":{"type":["integer","null"],"exclusiveMinimum":0,"maximum":100000000}},"required":["kind","method","amountCents"],"additionalProperties":false}}}},"responses":{"200":{"description":"Original payment replayed for the same key and body","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecordedPayment"}},"required":["data"]}}}},"201":{"description":"The recorded payment or refund","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RecordedPayment"}},"required":["data"]}}}},"400":{"description":"Invalid request, including a negative amount, a zero amount other than in cash (a 0c PAYMENT settling 1c or 2c, or a 0c REFUND of the rounding alone, which the balance must also allow), tenderedCents on anything but a cash PAYMENT or below the amount, an unknown key, or a malformed Idempotency-Key (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN), or a REFUND at a station that is not premium (PREMIUM_REQUIRED). A PAYMENT is never premium-gated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such invoice in the caller's station (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The invoice is a draft or a credit note (INVOICE_NOT_PAYABLE), a payment exceeds the balance (PAYMENT_EXCEEDS_BALANCE), a refund exceeds what has been paid (REFUND_EXCEEDS_PAID), a card or bank refund would leave a net paid that the cash refund reversing outstanding rounding cannot return (REFUND_ROUNDING_NEEDS_CASH), a concurrent write conflicted and may be retried (PAYMENT_WRITE_CONFLICT), or the Idempotency-Key was already used for a different payment (IDEMPOTENCY_KEY_REUSED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/customer-accounts":{"get":{"tags":["Station Portal"],"summary":"List the station's customer accounts with money owing","description":"Station OWNER or STAFF. Not premium-gated. The caller's station only: one row per customer with a balance owing on its issued invoices, and one row per owing invoice with no customer (walk-ins are never merged). Paid and in-credit invoices are left out. sort=amount (the default) orders by the outstanding balance, largest first; sort=age orders by the oldest invoice still owing, oldest first. page defaults to 1, limit to 20 (at most 100).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":1000000,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["amount","age"],"default":"amount"},"required":false,"name":"sort","in":"query"}],"responses":{"200":{"description":"A page of account summaries","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StationCustomerAccountSummary"}},"meta":{"type":"object","properties":{"page":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"},"perPage":{"type":"number"}},"required":["page","total","totalPages","perPage"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/customer-accounts/{customerId}":{"get":{"tags":["Station Portal"],"summary":"Get a customer's account at this station","description":"Station OWNER or STAFF. Not premium-gated. One customer's bookings, Jobs, invoices (with balances), payments and outstanding balance at the caller's station only: no other station's records are ever included. A customer with no booking or invoice at this station is 404.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":128},"required":true,"name":"customerId","in":"path"}],"responses":{"200":{"description":"The customer's account at the station","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StationCustomerAccount"}},"required":["data"]}}}},"400":{"description":"Invalid request (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not a member of a station (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"The customer has no booking or invoice at the caller's station, or the id is unknown (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/blog":{"get":{"tags":["Blog"],"summary":"List published blog posts","description":"Paginated list of published blog posts, optionally filtered by category slug.","parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"category","in":"query"}],"responses":{"200":{"description":"Paginated published posts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}}}}},"/api/v1/blog/categories":{"get":{"tags":["Blog"],"summary":"List blog categories","responses":{"200":{"description":"All blog categories","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","name","slug","createdAt"]}}},"required":["data"]}}}}}}},"/api/v1/blog/{slug}":{"get":{"tags":["Blog"],"summary":"Get published blog post by slug","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Blog post detail","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"content":{"type":"string"},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt","content","metaTitle","metaDescription"]}},"required":["data"]}}}},"404":{"description":"Post not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/stations":{"get":{"tags":["Internal"],"summary":"List stations (admin)","description":"Internal admin endpoint to list all stations. Requires onorto:admin role.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"suburb","in":"query"},{"schema":{"type":"string"},"required":false,"name":"postcode","in":"query"},{"schema":{"type":["number","null"],"minimum":-90,"maximum":90},"required":false,"name":"lat","in":"query"},{"schema":{"type":["number","null"],"minimum":-180,"maximum":180},"required":false,"name":"lng","in":"query"},{"schema":{"type":"number","exclusiveMinimum":0,"default":10},"required":false,"name":"radius","in":"query"},{"schema":{"type":"string","maxLength":128},"required":false,"name":"search","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}]},"required":false,"name":"bookOnline","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}]},"required":false,"name":"eSafety","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}]},"required":false,"name":"openNow","in":"query"},{"schema":{"type":"string","enum":["light","heavy","motorcycle","trailer"]},"required":false,"name":"vehicleClass","in":"query"},{"schema":{"type":"string","enum":["recommended","nearest"]},"required":false,"name":"sort","in":"query"},{"schema":{"anyOf":[{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]},{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]}}]},"required":false,"name":"accreditation","in":"query"}],"responses":{"200":{"description":"Paginated list of stations","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"address":{"type":"string"},"suburb":{"type":"string"},"postcode":{"type":"string"},"state":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"},"phone":{"type":["string","null"]},"accreditations":{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]}},"isActive":{"type":"boolean"},"isPremium":{"type":"boolean"},"distanceKm":{"type":"number"},"googleRating":{"type":["number","null"]},"googleReviewCount":{"type":["number","null"]},"heroImageUrl":{"type":["string","null"]},"bookable":{"type":"boolean"},"nextFree":{"type":["string","null"],"format":"date-time"}},"required":["id","name","slug","address","suburb","postcode","state","latitude","longitude","phone","accreditations","isActive","isPremium","googleRating","googleReviewCount","heroImageUrl","bookable"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Internal"],"summary":"Create station","description":"Create a new inspection station. Requires onorto:admin role.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"slug":{"type":"string","minLength":1,"maxLength":255,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"address":{"type":"string","minLength":1,"maxLength":500},"suburb":{"type":"string","minLength":1,"maxLength":100},"postcode":{"type":"string","minLength":1,"maxLength":10},"state":{"type":"string","minLength":1,"maxLength":10,"default":"NSW"},"latitude":{"type":"number","minimum":-90,"maximum":90},"longitude":{"type":"number","minimum":-180,"maximum":180},"phone":{"type":["string","null"],"maxLength":20},"email":{"type":["string","null"],"format":"email"},"website":{"type":["string","null"],"format":"uri"},"description":{"type":["string","null"],"maxLength":2000},"openingHours":{"type":["object","null"],"additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]}]}},"accreditations":{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]},"default":[]},"isActive":{"type":"boolean","default":true},"isPremium":{"type":"boolean","default":false},"billingExempt":{"type":"boolean","default":false}},"required":["name","slug","address","suburb","postcode","latitude","longitude"]}}}},"responses":{"201":{"description":"Station created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"address":{"type":"string"},"suburb":{"type":"string"},"postcode":{"type":"string"},"state":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"},"phone":{"type":["string","null"]},"accreditations":{"type":"array","items":{"type":"string","enum":["E_SAFETY_CHECK","SAFETY_CHECK","ALL_LIGHT_VEHICLES","HEAVY_VEHICLES","AUVIS","LPG","ACIS","MOTORCYCLES_ONLY","LIGHT_TRAILERS_ONLY","MOBILE"]}},"isActive":{"type":"boolean"},"isPremium":{"type":"boolean"},"distanceKm":{"type":"number"},"googleRating":{"type":["number","null"]},"googleReviewCount":{"type":["number","null"]},"heroImageUrl":{"type":["string","null"]},"bookable":{"type":"boolean"},"nextFree":{"type":["string","null"],"format":"date-time"},"timezone":{"type":"string"},"email":{"type":["string","null"]},"website":{"type":["string","null"]},"description":{"type":["string","null"]},"openingHours":{"type":["object","null"],"additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"open":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"close":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"required":["open","close"]}]}},"googlePlaceId":{"type":["string","null"]},"googleMapsUri":{"type":["string","null"]},"businessStatus":{"type":["string","null"]},"enrichment":{"type":["object","null"],"properties":{"photos":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"widthPx":{"type":"number"},"heightPx":{"type":"number"}},"required":["url","widthPx","heightPx"]}},"googleReviews":{"type":"array","items":{"type":"object","properties":{"author":{"type":["string","null"]},"rating":{"type":["number","null"]},"text":{"type":["string","null"]},"publishTime":{"type":["string","null"]}},"required":["author","rating","text","publishTime"]}},"socialLinks":{"type":"object","properties":{"facebook":{"type":"string"},"instagram":{"type":"string"},"twitter":{"type":"string"},"tiktok":{"type":"string"},"youtube":{"type":"string"},"linkedin":{"type":"string"}}},"googleOpeningHours":{"type":"array","items":{"type":"string"}}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","slug","address","suburb","postcode","state","latitude","longitude","phone","accreditations","isActive","isPremium","googleRating","googleReviewCount","heroImageUrl","bookable","timezone","email","website","description","openingHours","googlePlaceId","googleMapsUri","businessStatus","enrichment","createdAt","updatedAt"]}},"required":["data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/bookings":{"get":{"tags":["Internal"],"summary":"List bookings (admin)","description":"List and search bookings across all stations. Requires onorto:admin role.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"search","in":"query"},{"schema":{"type":"string","enum":["PENDING","CONFIRMED","CHECKED_IN","COMPLETED","CANCELLED","NO_SHOW","RESCHEDULED"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"stationId","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":false,"name":"to","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"pageSize","in":"query"}],"responses":{"200":{"description":"Paginated list of bookings","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}},"400":{"description":"Invalid query (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Missing onorto:admin role (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/bookings/{id}":{"get":{"tags":["Internal"],"summary":"Get booking (admin)","description":"Full booking detail (station, customer, vehicle). Requires onorto:admin role.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Booking detail","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock"]}},"required":["data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Missing onorto:admin role (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Booking not found (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/bookings/{id}/cancel":{"post":{"tags":["Internal"],"summary":"Cancel a booking (admin)","description":"Cancel a PENDING or CONFIRMED customer booking on the customer’s behalf; the customer is notified. Station diary entries are rejected. Requires onorto:admin role.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000}}}}}},"responses":{"200":{"description":"Cancelled booking","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock"]}},"required":["data"]}}}},"400":{"description":"Invalid body, station diary entry, or booking not in a cancellable status (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Missing onorto:admin role (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Booking not found (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Customer deleted their account (BOOKING_CUSTOMER_DELETED), or booking changed concurrently (BOOKING_CONFLICT)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/bookings/{id}/reschedule":{"post":{"tags":["Internal"],"summary":"Reschedule a booking (admin)","description":"Move a PENDING or CONFIRMED customer booking to a new slot at the same station. The original becomes RESCHEDULED and a CONFIRMED replacement is returned. Provide either scheduledAt or date + timeSlot. Station diary entries are rejected. Requires onorto:admin role.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scheduledAt":{"type":"string","format":"date-time"},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"timeSlot":{"type":"string","pattern":"^\\d{2}:\\d{2}$"}}}}}},"responses":{"200":{"description":"New booking created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"stationName":{"type":"string"},"stationSlug":{"type":"string"},"vehicleId":{"type":["string","null"]},"vehicleRego":{"type":["string","null"]},"vehicleMake":{"type":["string","null"]},"vehicleModel":{"type":["string","null"]},"date":{"type":"string"},"timeSlot":{"type":["string","null"]},"bookedMode":{"type":"string","enum":["SLOT","DAY"]},"status":{"type":"string"},"inspectionResult":{"type":["string","null"]},"recheck":{"type":["object","null"],"properties":{"deadline":{"type":"string","format":"date"},"daysLeft":{"type":"integer","minimum":0},"available":{"type":"boolean"}},"required":["deadline","daysLeft","available"]},"cancelledBy":{"type":["string","null"],"enum":["CUSTOMER","STATION","SUPPORT",null],"description":"Who cancelled: the customer, the station (including an own-work diary cancel) or support. Null when not cancelled, or cancelled before this was recorded."},"cancellationReason":{"type":["string","null"],"maxLength":200,"description":"The customer’s own cancellation reason, trimmed and collapsed to one line. Never a station’s or support’s reason, which stay internal."},"createdAt":{"type":"string"},"customerId":{"type":["string","null"]},"customerFirstName":{"type":["string","null"]},"customerLastName":{"type":["string","null"]},"customerEmail":{"type":["string","null"]},"customerPhone":{"type":["string","null"]},"notes":{"type":["string","null"]},"rescheduledFromId":{"type":["string","null"]},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["CUSTOMER","STATION"]},"bookedByStation":{"type":"boolean"},"checkedInAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"vehicleRegoState":{"type":["string","null"]},"vehicleYear":{"type":["integer","null"]},"title":{"type":["string","null"]},"walkInName":{"type":["string","null"]},"walkInPhone":{"type":["string","null"]},"walkInRego":{"type":["string","null"]},"jobGroupId":{"type":["string","null"]},"isBlock":{"type":"boolean"}},"required":["id","stationId","stationName","stationSlug","vehicleId","vehicleRego","vehicleMake","vehicleModel","date","timeSlot","bookedMode","status","inspectionResult","recheck","cancelledBy","cancellationReason","createdAt","customerId","customerFirstName","customerLastName","customerEmail","customerPhone","notes","rescheduledFromId","updatedAt","source","bookedByStation","checkedInAt","completedAt","vehicleRegoState","vehicleYear","title","walkInName","walkInPhone","walkInRego","jobGroupId","isBlock"]}},"required":["data"]}}}},"400":{"description":"Invalid body, station diary entry, status not reschedulable, date closed, or new slot unavailable (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Missing onorto:admin role (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Booking not found (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Customer deleted their account (BOOKING_CUSTOMER_DELETED), booking changed concurrently (BOOKING_CONFLICT), or the car was removed from the customer's garage (VEHICLE_ARCHIVED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/stations/{id}/osint":{"get":{"tags":["Internal"],"summary":"Get OSINT data for a station (admin)","description":"Returns parsed OSINT metadata for admin review. Requires onorto:admin role.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OSINT data","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"stationId":{"type":"string"},"metadata":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["stationId","metadata","createdAt","updatedAt"]}},"required":["data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"OSINT data not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/stations/{id}/osint/merge":{"post":{"tags":["Internal"],"summary":"Merge OSINT data into station","description":"Selectively merge OSINT enrichment fields into the station record. Requires onorto:admin role.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fieldGroups":{"type":"array","items":{"type":"string","enum":["googlePlaceId","rating","googleMapsUri","businessStatus","heroImage","photos","googleReviews","socialLinks","openingHours","phone","website","location","all"]},"minItems":1}},"required":["fieldGroups"]}}}},"responses":{"200":{"description":"Fields merged successfully","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"merged":{"type":"boolean","enum":[true]}},"required":["merged"]}},"required":["data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Station or OSINT data not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/blog":{"get":{"tags":["Internal Blog"],"summary":"List all blog posts (admin)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"search","in":"query"}],"responses":{"200":{"description":"Paginated blog posts (any status)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt","source","reviewNote","submittedAt","reviewedAt","agentNotes"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}}}},"post":{"tags":["Internal Blog"],"summary":"Create blog post","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"excerpt":{"type":"string","maxLength":500},"content":{"type":"string","minLength":1},"featuredImage":{"type":"string","format":"uri"},"authorName":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"type":"string","minLength":1},"metaTitle":{"type":"string","maxLength":70},"metaDescription":{"type":"string","maxLength":160}},"required":["title","content","authorName"]}}}},"responses":{"201":{"description":"Blog post created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"content":{"type":"string"},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt","content","metaTitle","metaDescription","source","reviewNote","submittedAt","reviewedAt","agentNotes"]}},"required":["data"]}}}}}}},"/api/int-2026/blog/categories":{"get":{"tags":["Internal Blog"],"summary":"List blog categories (admin)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"All blog categories","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","name","slug","createdAt"]}}},"required":["data"]}}}}}},"post":{"tags":["Internal Blog"],"summary":"Create blog category","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"slug":{"type":"string","minLength":1,"maxLength":100}},"required":["name"]}}}},"responses":{"201":{"description":"Category created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","name","slug","createdAt"]}},"required":["data"]}}}}}}},"/api/int-2026/blog/categories/{id}":{"put":{"tags":["Internal Blog"],"summary":"Update blog category","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"slug":{"type":"string","minLength":1,"maxLength":100}}}}}},"responses":{"200":{"description":"Category updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","name","slug","createdAt"]}},"required":["data"]}}}}}},"delete":{"tags":["Internal Blog"],"summary":"Delete blog category","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Category deleted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]},"postsUncategorized":{"type":"number"}},"required":["deleted","postsUncategorized"]}},"required":["data"]}}}}}}},"/api/int-2026/blog/{id}":{"get":{"tags":["Internal Blog"],"summary":"Get blog post by ID (admin)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Blog post detail","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"content":{"type":"string"},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt","content","metaTitle","metaDescription","source","reviewNote","submittedAt","reviewedAt","agentNotes"]}},"required":["data"]}}}},"404":{"description":"Post not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["Internal Blog"],"summary":"Update blog post","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":1,"description":"Slug must contain only lowercase letters, digits and single hyphens, at most 200 characters. A stored legacy slug that breaks this rule may be sent back unchanged."},"excerpt":{"type":"string","maxLength":500},"content":{"type":"string","minLength":1},"featuredImage":{"type":["string","null"],"format":"uri"},"authorName":{"type":"string","minLength":1,"maxLength":100},"categoryId":{"type":["string","null"],"minLength":1},"metaTitle":{"type":["string","null"],"maxLength":70},"metaDescription":{"type":["string","null"],"maxLength":160}}}}}},"responses":{"200":{"description":"Blog post updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"content":{"type":"string"},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt","content","metaTitle","metaDescription","source","reviewNote","submittedAt","reviewedAt","agentNotes"]}},"required":["data"]}}}}}},"delete":{"tags":["Internal Blog"],"summary":"Delete blog post","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Blog post deleted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"]}},"required":["data"]}}}}}}},"/api/int-2026/blog/{id}/publish":{"post":{"tags":["Internal Blog"],"summary":"Publish blog post","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Blog post published","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"content":{"type":"string"},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt","content","metaTitle","metaDescription","source","reviewNote","submittedAt","reviewedAt","agentNotes"]}},"required":["data"]}}}}}}},"/api/int-2026/blog/{id}/schedule":{"post":{"tags":["Internal Blog"],"summary":"Schedule blog post","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scheduledAt":{"type":"string","format":"date-time"}},"required":["scheduledAt"]}}}},"responses":{"200":{"description":"Blog post scheduled","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"content":{"type":"string"},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt","content","metaTitle","metaDescription","source","reviewNote","submittedAt","reviewedAt","agentNotes"]}},"required":["data"]}}}}}}},"/api/int-2026/blog/{id}/request-changes":{"post":{"tags":["Internal Blog"],"summary":"Request changes on a blog post in review","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","minLength":1,"maxLength":2000}},"required":["note"]}}}},"responses":{"200":{"description":"Changes requested","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"content":{"type":"string"},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt","content","metaTitle","metaDescription","source","reviewNote","submittedAt","reviewedAt","agentNotes"]}},"required":["data"]}}}}}}},"/api/int-2026/blog/{id}/archive":{"post":{"tags":["Internal Blog"],"summary":"Archive blog post","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","maxLength":2000}}}}}},"responses":{"200":{"description":"Blog post archived","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"type":["string","null"]},"featuredImage":{"type":["string","null"]},"authorName":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"categoryId":{"type":["string","null"]},"categoryName":{"type":["string","null"]},"categorySlug":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"readTimeMinutes":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"content":{"type":"string"},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","title","slug","excerpt","featuredImage","authorName","status","categoryId","categoryName","categorySlug","publishedAt","scheduledAt","readTimeMinutes","createdAt","updatedAt","content","metaTitle","metaDescription","source","reviewNote","submittedAt","reviewedAt","agentNotes"]}},"required":["data"]}}}}}}},"/api/int-2026/upload":{"post":{"tags":["Internal Blog"],"summary":"Generate presigned upload URL","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","pattern":"^image\\/"}},"required":["filename","contentType"]}}}},"responses":{"200":{"description":"Presigned upload URL","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"uploadUrl":{"type":"string"},"publicUrl":{"type":"string"},"key":{"type":"string"}},"required":["uploadUrl","publicUrl","key"]}},"required":["data"]}}}}}}},"/api/int-2026/media/images":{"post":{"tags":["Internal Blog"],"summary":"Upload an image to the CDN","description":"Decodes a base64 JPEG, PNG, WebP, GIF or AVIF image (at most 10 MiB, 40 megapixels; SVG and animated images are refused), applies EXIF orientation, strips metadata, fits the main image inside 2400 px and stores WebP with 1280w, 1024w and 768w variants (without enlargement). Keys use blog/hero/ or blog/inline/ according to kind. Returns HTTPS CDN URLs for the main image and all variants. Requires onorto:admin role.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"base64":{"type":"string","minLength":1,"maxLength":10485760},"kind":{"type":"string","enum":["blog-hero","blog-inline"]}},"required":["base64","kind"]}}}},"responses":{"200":{"description":"Image stored; served from the CloudFront CDN","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UploadedImage"}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid body (missing or non-base64 `base64`, unknown `kind`), empty or over 10 MiB, not a supported image, SVG, animated, over the pixel cap, corrupt or truncated, or uploads not configured (no bucket or CDN domain)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid Clerk session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: missing onorto:admin role","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/system/media/images":{"post":{"tags":["System"],"summary":"Upload an image to the CDN","description":"Decodes a base64 JPEG, PNG, WebP, GIF or AVIF image (at most 10 MiB, 40 megapixels; SVG and animated images are refused), applies EXIF orientation, strips metadata, fits the main image inside 2400 px and stores WebP with 1280w, 1024w and 768w variants (without enlargement). Keys use blog/hero/ or blog/inline/ according to kind. Returns HTTPS CDN URLs for the main image and all variants. Requires a system API key with the media:write scope.","security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"base64":{"type":"string","minLength":1,"maxLength":10485760},"kind":{"type":"string","enum":["blog-hero","blog-inline"]}},"required":["base64","kind"]}}}},"responses":{"200":{"description":"Image stored; served from the CloudFront CDN","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UploadedImage"}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid body (missing or non-base64 `base64`, unknown `kind`), empty or over 10 MiB, not a supported image, SVG, animated, over the pixel cap, corrupt or truncated, or uploads not configured (no bucket or CDN domain)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the media:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/system/osint/{stationId}":{"post":{"tags":["System"],"summary":"Upsert OSINT data for a station","description":"Creates or updates OSINT enrichment data for a station. Requires system API key.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"stationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"enrichedAt":{"type":"string","format":"date-time"},"googlePlaces":{"type":"object","additionalProperties":{}},"website":{"type":"object","additionalProperties":{}},"googleStreetView":{"type":"object","additionalProperties":{}}},"required":["enrichedAt"],"additionalProperties":{}}}}},"responses":{"200":{"description":"OSINT data upserted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"stationId":{"type":"string"},"metadata":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["stationId","metadata","createdAt","updatedAt"]}},"required":["data"]}}}},"401":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Station not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Enrichment too recent — must wait 30 days between enrichments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"get":{"tags":["System"],"summary":"Get OSINT data for a station","description":"Retrieves OSINT enrichment data for a station. Requires system API key.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"stationId","in":"path"}],"responses":{"200":{"description":"OSINT data","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"stationId":{"type":"string"},"metadata":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["stationId","metadata","createdAt","updatedAt"]}},"required":["data"]}}}},"401":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"OSINT data not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/system/blog/categories":{"get":{"tags":["System"],"summary":"List blog categories","description":"Lists every blog category by name, so a draft can be filed under a categoryId. Requires a system API key with the content:read scope. No machine route can publish, schedule or archive a post, or edit a MANUAL post.","security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Blog categories, ordered by name","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}}},"required":["data"]}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/system/blog/posts":{"get":{"tags":["System"],"summary":"List blog posts in every status","description":"Lists blog posts in every status (newest update first), without their body, so an agent can avoid duplicate topics. Filter by status, or search title and slug with q. Requires a system API key with the content:read scope. No machine route can publish, schedule or archive a post, or edit a MANUAL post.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Paginated blog post rows (no content field)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"updatedAt":{"type":"string"}},"required":["id","slug","title","status","source","reviewNote","submittedAt","updatedAt"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}},"400":{"description":"VALIDATION_ERROR: invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["System"],"summary":"Create a blog draft","description":"Creates a post with status DRAFT and source AGENT. The slug is derived from the title when omitted. status, source and authorName in the body are ignored. Requires a system API key with the content:draft:write scope. No machine route can publish, schedule or archive a post, or edit a MANUAL post.","security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"excerpt":{"type":"string","maxLength":500},"content":{"type":"string","minLength":1,"maxLength":100000},"featuredImage":{"type":"string","format":"uri"},"categoryId":{"type":"string","minLength":1},"metaTitle":{"type":"string","maxLength":70},"metaDescription":{"type":"string","maxLength":160},"agentNotes":{"type":"string","maxLength":10000}},"required":["title","content"]}}}},"responses":{"201":{"description":"Draft created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"updatedAt":{"type":"string"},"excerpt":{"type":["string","null"]},"content":{"type":"string"},"featuredImage":{"type":["string","null"]},"categoryId":{"type":["string","null"]},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]},"authorName":{"type":"string"},"reviewedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","slug","title","status","source","reviewNote","submittedAt","updatedAt","excerpt","content","featuredImage","categoryId","metaTitle","metaDescription","agentNotes","authorName","reviewedAt","createdAt"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid body, a slug cannot be derived from the title, or the category does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:draft:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"SLUG_TAKEN: a blog post with this slug already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/system/blog/posts/{id}":{"get":{"tags":["System"],"summary":"Get a blog post","description":"Returns the full post (content, excerpt, SEO fields, agent notes) only while it is DRAFT, IN_REVIEW or CHANGES_REQUESTED. A post in any other status returns just the list-row fields. Requires a system API key with the content:read scope. No machine route can publish, schedule or archive a post, or edit a MANUAL post.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The post: full detail, or row fields for SCHEDULED, PUBLISHED and ARCHIVED","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"updatedAt":{"type":"string"},"excerpt":{"type":["string","null"]},"content":{"type":"string"},"featuredImage":{"type":["string","null"]},"categoryId":{"type":["string","null"]},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]},"authorName":{"type":"string"},"reviewedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","slug","title","status","source","reviewNote","submittedAt","updatedAt","excerpt","content","featuredImage","categoryId","metaTitle","metaDescription","agentNotes","authorName","reviewedAt","createdAt"]},{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"updatedAt":{"type":"string"}},"required":["id","slug","title","status","source","reviewNote","submittedAt","updatedAt"]}]}},"required":["data"]}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: blog post not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["System"],"summary":"Update a blog draft","description":"Partially updates an AGENT post in DRAFT or CHANGES_REQUESTED; null clears an optional field and at least one field is required. Any other post fails closed with 409. Requires a system API key with the content:draft:write scope. No machine route can publish, schedule or archive a post, or edit a MANUAL post.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":1,"description":"Slug must contain only lowercase letters, digits and single hyphens, at most 200 characters. A stored legacy slug that breaks this rule may be sent back unchanged."},"excerpt":{"type":["string","null"],"maxLength":500},"content":{"type":"string","minLength":1,"maxLength":100000},"featuredImage":{"type":["string","null"],"format":"uri"},"categoryId":{"type":["string","null"],"minLength":1},"metaTitle":{"type":["string","null"],"maxLength":70},"metaDescription":{"type":["string","null"],"maxLength":160},"agentNotes":{"type":["string","null"],"maxLength":10000}}}}}},"responses":{"200":{"description":"Draft updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"updatedAt":{"type":"string"},"excerpt":{"type":["string","null"]},"content":{"type":"string"},"featuredImage":{"type":["string","null"]},"categoryId":{"type":["string","null"]},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]},"authorName":{"type":"string"},"reviewedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","slug","title","status","source","reviewNote","submittedAt","updatedAt","excerpt","content","featuredImage","categoryId","metaTitle","metaDescription","agentNotes","authorName","reviewedAt","createdAt"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid body, no field given, or the category does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:draft:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: blog post not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"NOT_EDITABLE: the post is not an AGENT draft in DRAFT or CHANGES_REQUESTED; CONCURRENT_EDIT: it changed during the request, retry; or SLUG_TAKEN: the slug already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/system/blog/posts/{id}/submit":{"post":{"tags":["System"],"summary":"Submit a blog draft for review","description":"Moves an AGENT post from DRAFT or CHANGES_REQUESTED to IN_REVIEW. An optional note is appended to agentNotes. A person reviews and publishes it in internal-admin. Requires a system API key with the content:draft:write scope. No machine route can publish, schedule or archive a post, or edit a MANUAL post.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","minLength":1,"maxLength":10000}},"default":{}}}}},"responses":{"200":{"description":"Draft submitted for review","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","CHANGES_REQUESTED","SCHEDULED","PUBLISHED","ARCHIVED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"reviewNote":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"updatedAt":{"type":"string"},"excerpt":{"type":["string","null"]},"content":{"type":"string"},"featuredImage":{"type":["string","null"]},"categoryId":{"type":["string","null"]},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]},"authorName":{"type":"string"},"reviewedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","slug","title","status","source","reviewNote","submittedAt","updatedAt","excerpt","content","featuredImage","categoryId","metaTitle","metaDescription","agentNotes","authorName","reviewedAt","createdAt"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid body, or the note would push agentNotes over 10000 characters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:draft:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: blog post not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"NOT_EDITABLE: the post is not an AGENT draft in DRAFT or CHANGES_REQUESTED; or CONCURRENT_EDIT: it changed during the request, retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/system/mot-town-pages":{"get":{"tags":["System"],"summary":"List MOT town pages in every status","description":"Lists GetMyMOT town intro pages in every status (newest update first), without their body, so an agent can see which towns already have a page. Filter by status, or search townSlug with q. Requires a system API key with the content:read scope. No machine route can publish, schedule or unpublish a page, or set its review note.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":100},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Paginated MOT town page rows (no intro field)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}},"400":{"description":"VALIDATION_ERROR: invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["System"],"summary":"Create an MOT town page draft","description":"Creates the intro page of a listed GetMyMOT town with status DRAFT and source AGENT; a town has at most one page. The intro is 150 to 250 words and heroImage an https: URL. The body is strict: any other field (status, source, publishedAt, scheduledAt, reviewNote, ...) is a 400. Requires a system API key with the content:draft:write scope. No machine route can publish, schedule or unpublish a page, or set its review note.","security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"townSlug":{"type":"string","maxLength":100,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"intro":{"type":"string","maxLength":5000},"heroImage":{"type":"string","format":"uri"},"metaTitle":{"type":"string","maxLength":70},"metaDescription":{"type":"string","maxLength":160},"agentNotes":{"type":"string","maxLength":10000}},"required":["townSlug","intro"],"additionalProperties":false}}}},"responses":{"201":{"description":"Draft created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid or unknown body field, an intro out of the word range, or no listed MOT town has the townSlug","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:draft:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"TOWN_PAGE_EXISTS: this town already has an intro page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/system/mot-town-pages/{id}":{"get":{"tags":["System"],"summary":"Get an MOT town page","description":"Returns the full page (intro, SEO fields, agent notes, review note) in any status. Requires a system API key with the content:read scope. No machine route can publish, schedule or unpublish a page, or set its review note.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The page","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: MOT town page not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["System"],"summary":"Update an MOT town page draft","description":"Partially updates an AGENT page in DRAFT; null clears an optional field and at least one field is required. The town cannot change. An edit clears submittedAt. The body is strict. Any other page fails closed with 409. Requires a system API key with the content:draft:write scope. No machine route can publish, schedule or unpublish a page, or set its review note.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"intro":{"type":"string","maxLength":5000},"heroImage":{"type":["string","null"],"format":"uri"},"metaTitle":{"type":["string","null"],"maxLength":70},"metaDescription":{"type":["string","null"],"maxLength":160},"agentNotes":{"type":["string","null"],"maxLength":10000}},"additionalProperties":false}}}},"responses":{"200":{"description":"Draft updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid or unknown body field, or no field given","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:draft:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: MOT town page not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"NOT_EDITABLE: the page is not an AGENT page in DRAFT; or CONCURRENT_EDIT: it changed during the request, retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/system/mot-town-pages/{id}/submit":{"post":{"tags":["System"],"summary":"Submit an MOT town page draft for review","description":"Sets submittedAt on an AGENT page in DRAFT; it stays a DRAFT. An optional note is appended to agentNotes. A person reviews and publishes it in internal-admin. Requires a system API key with the content:draft:write scope. No machine route can publish, schedule or unpublish a page, or set its review note.","security":[{"apiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","minLength":1,"maxLength":10000}},"default":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Draft submitted for review","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid body, or the note would push agentNotes over 10000 characters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"UNAUTHORIZED: missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"FORBIDDEN: the API key lacks the content:draft:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: MOT town page not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"NOT_EDITABLE: the page is not an AGENT page in DRAFT; or CONCURRENT_EDIT: it changed during the request, retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: system API rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/mot-town-pages":{"get":{"tags":["Internal MOT Town Pages"],"summary":"List MOT town pages (admin)","description":"Every GetMyMOT town intro page in every status, newest update first, no body.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":100},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Paginated MOT town page rows (no intro field)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt"]}},"meta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"]}},"required":["data","meta"]}}}},"400":{"description":"VALIDATION_ERROR: invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/mot-town-pages/{id}":{"get":{"tags":["Internal MOT Town Pages"],"summary":"Get an MOT town page (admin)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The page","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"404":{"description":"NOT_FOUND: MOT town page not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["Internal MOT Town Pages"],"summary":"Update an MOT town page (admin)","description":"Partially updates the intro, hero image or SEO fields of a page in any status; null clears an optional field and at least one field is required. The body is strict: any other field is a 400.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"intro":{"type":"string","maxLength":5000},"heroImage":{"type":["string","null"],"format":"uri"},"metaTitle":{"type":["string","null"],"maxLength":70},"metaDescription":{"type":["string","null"],"maxLength":160}},"additionalProperties":false}}}},"responses":{"200":{"description":"Page updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid body, unknown field, or no field given","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: MOT town page not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/mot-town-pages/{id}/publish":{"post":{"tags":["Internal MOT Town Pages"],"summary":"Publish an MOT town page","description":"DRAFT or SCHEDULED to PUBLISHED now. The body carries expectedUpdatedAt, the page updatedAt the reviewer read; if the page changed since (an agent edit after review) the call fails with 409 STALE and nothing is published. Publishing a PUBLISHED page changes nothing (200).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedUpdatedAt":{"type":["string","null"],"format":"date-time"}},"required":["expectedUpdatedAt"]}}}},"responses":{"200":{"description":"Page published (or already published)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: expectedUpdatedAt missing or invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: MOT town page not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"STALE: the page changed since the reviewer read it (re-read and review again)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/mot-town-pages/{id}/schedule":{"post":{"tags":["Internal MOT Town Pages"],"summary":"Schedule an MOT town page","description":"DRAFT or SCHEDULED to SCHEDULED at a future time; the public town route shows it once that time has passed. The body also carries expectedUpdatedAt, the page updatedAt the reviewer read. A live page (PUBLISHED, or SCHEDULED and already due) is refused: unpublish it first.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scheduledAt":{"type":"string","format":"date-time"},"expectedUpdatedAt":{"type":["string","null"],"format":"date-time"}},"required":["scheduledAt","expectedUpdatedAt"]}}}},"responses":{"200":{"description":"Page scheduled","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: scheduledAt or expectedUpdatedAt missing or invalid, or scheduledAt not in the future","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: MOT town page not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"STALE: the page changed since the reviewer read it; INVALID_STATUS: a live page (PUBLISHED, or SCHEDULED and already due) cannot be scheduled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/mot-town-pages/{id}/unpublish":{"post":{"tags":["Internal MOT Town Pages"],"summary":"Unpublish an MOT town page","description":"PUBLISHED or SCHEDULED back to DRAFT, off the site and out of the schedule.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Page unpublished","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"404":{"description":"NOT_FOUND: MOT town page not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"INVALID_STATUS: a DRAFT page cannot be unpublished","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/mot-town-pages/{id}/review-note":{"put":{"tags":["Internal MOT Town Pages"],"summary":"Set the review note on an MOT town page","description":"The reviewer's note for the agent; null or blank clears it.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":["string","null"],"maxLength":2000}},"required":["note"]}}}},"responses":{"200":{"description":"Review note set","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"townSlug":{"type":"string"},"heroImage":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED"]},"source":{"type":"string","enum":["MANUAL","AGENT"]},"publishedAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"submittedAt":{"type":["string","null"]},"reviewedAt":{"type":["string","null"]},"reviewNote":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"intro":{"type":"string"},"heroImageVariants":{"type":["object","null"],"additionalProperties":{"type":"string"}},"metaTitle":{"type":["string","null"]},"metaDescription":{"type":["string","null"]},"agentNotes":{"type":["string","null"]}},"required":["id","townSlug","heroImage","status","source","publishedAt","scheduledAt","submittedAt","reviewedAt","reviewNote","createdAt","updatedAt","intro","heroImageVariants","metaTitle","metaDescription","agentNotes"]}},"required":["data"]}}}},"400":{"description":"VALIDATION_ERROR: invalid body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"NOT_FOUND: MOT town page not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/mot-claims":{"post":{"tags":["Station Portal"],"summary":"Claim a GetMyMOT garage listing","description":"Starts a claim on a DVSA-listed garage by its site number. A mobile phone number on the listing is sent a 6-digit SMS code valid for 10 minutes (state OTP_SENT). A landline, no listed phone, or no SMS transport configured puts the claim straight into manual review (state IN_REVIEW, no channel), where staff verify it by calling the listed number. A claim left SUBMITTED for over an hour, or OTP_SENT 24 hours after its code expired, no longer blocks other claimants. The phone is never returned beyond its last 3 digits (phoneHint). Code sends are limited to 3 per listing per hour and 5 per user per day. UK platform only.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"siteNumber":{"type":"string","pattern":"^[A-Za-z0-9]{1,20}$"},"legalName":{"type":"string","minLength":1,"maxLength":160},"tradingName":{"type":"string","minLength":1,"maxLength":160},"companyNumber":{"type":"string","description":"Companies House number: 8 digits, or SC, NI, OC and similar prefix and 6 digits. Spaces and case are ignored.","example":"SC123456"},"vatNumber":{"type":"string","description":"UK VAT number: 9 or 12 digits with an optional GB prefix; stored as GB and the digits.","example":"GB123456789"}},"required":["siteNumber","legalName"],"additionalProperties":false}}}},"responses":{"201":{"description":"Claim started","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"claimId":{"type":"string"},"state":{"type":"string","enum":["OTP_SENT","IN_REVIEW"]},"channel":{"type":["string","null"],"enum":["sms"]},"phoneHint":{"type":["string","null"],"pattern":"^\\d{3}$","description":"The last 3 digits of the DVSA-listed phone; never more"}},"required":["claimId","state","channel","phoneHint"]}},"required":["data"]}}}},"400":{"description":"Invalid body (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No listing with this site number (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"ALREADY_CLAIMED: the listing is linked to a Business, or another user has a live claim on it (a DISPUTED row is recorded); CLAIM_NOT_PENDING: the caller already has a live claim, or a claim of the caller already linked the listing (details: claimId, state; state is LINKED in that case)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"LISTING_DELISTED: the listing was withdrawn from the DVSA register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: more than 3 code sends per listing per hour, more than 5 per user per day, or the per-IP limiter (30 requests per 15 minutes per IP across the three station claim routes)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"SMS_UNAVAILABLE: the SMS provider refused or failed the first send. The claim was made and stays OTP_SENT (details: claimId); ask for a code with resend. The send still counts against the send limits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/mot-claims/{claimId}/verify":{"post":{"tags":["Station Portal"],"summary":"Verify the code sent for a garage claim","description":"Checks the 6-digit code. On success the GB Business, the caller's OWNER membership and a Clerk organization are created and the claim moves to IN_REVIEW to await admin review; the listing is linked only when an admin approves. 5 wrong codes end the code; ask for a new one with resend. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"claimId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["code"],"additionalProperties":false}}}},"responses":{"200":{"description":"Code accepted; the claim awaits review","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"claimId":{"type":"string"},"state":{"type":"string","enum":["IN_REVIEW"]},"businessId":{"type":"string"}},"required":["claimId","state","businessId"]}},"required":["data"]}}}},"400":{"description":"INVALID_CODE: the code is wrong (details: attemptsLeft); VALIDATION_ERROR: the code is not 6 digits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such claim, or it is not the caller's (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CLAIM_NOT_PENDING: the claim is not waiting for a code; ALREADY_CLAIMED: the listing was linked meanwhile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"CODE_EXPIRED: the code is older than 10 minutes; resend within 24 hours of its expiry, after that claim the listing again; LISTING_DELISTED: the listing was delisted since the claim was made","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"TOO_MANY_ATTEMPTS: 5 wrong codes, request a new one; RATE_LIMITED: the per-IP limiter (30 requests per 15 minutes per IP across the three station claim routes)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/station/mot-claims/{claimId}/resend":{"post":{"tags":["Station Portal"],"summary":"Send a new code for a garage claim","description":"Sends a fresh code to the DVSA-listed mobile; it counts against the same send limits as the first send. The phone is never returned beyond its last 3 digits. UK platform only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"claimId","in":"path"}],"responses":{"200":{"description":"A new code was sent","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"claimId":{"type":"string"},"state":{"type":"string","enum":["OTP_SENT","IN_REVIEW"]},"channel":{"type":["string","null"],"enum":["sms"]},"phoneHint":{"type":["string","null"],"pattern":"^\\d{3}$","description":"The last 3 digits of the DVSA-listed phone; never more"}},"required":["claimId","state","channel","phoneHint"]}},"required":["data"]}}}},"400":{"description":"Malformed claim id (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such claim, or it is not the caller's (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CLAIM_NOT_PENDING: the claim is not waiting for a code, or went stale (its code expired over 24 hours ago); claim the listing again","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"LISTING_DELISTED: the listing was delisted since the claim was made","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED: a send limit is reached, or the per-IP limiter (30 requests per 15 minutes per IP across the three station claim routes)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"SMS_UNAVAILABLE: the code could not be sent, or the listing no longer has a mobile; try again later. A send the provider refused or failed was recorded before sending, so it still counts against the send limits and the previous code no longer passes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/gmm/claims":{"get":{"tags":["Internal GMM Claims"],"summary":"List GetMyMOT garage claims (admin)","description":"Claims by their latest state, newest first (by when the claim began), at most 200; filter with `state`. The filter and the page are applied in the query. Each claim carries its history (a safe evidence subset, never a code, hash, salt or phone number) and its Business once the code passed or staff approved it.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["SUGGESTED","SUBMITTED","OTP_SENT","OTP_PASSED","IN_REVIEW","LINKED","DISPUTED","REJECTED","REVOKED"]},"required":false,"name":"state","in":"query"}],"responses":{"200":{"description":"Claims, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"claims":{"type":"array","items":{"type":"object","properties":{"claimId":{"type":"string"},"state":{"type":"string","enum":["SUGGESTED","SUBMITTED","OTP_SENT","OTP_PASSED","IN_REVIEW","LINKED","DISPUTED","REJECTED","REVOKED"]},"claimantClerkUserId":{"type":["string","null"]},"listing":{"type":"object","properties":{"id":{"type":"string"},"siteNumber":{"type":"string"},"name":{"type":"string"},"town":{"type":"string"},"linkedBusinessId":{"type":["string","null"]}},"required":["id","siteNumber","name","town","linkedBusinessId"]},"history":{"type":"array","items":{"type":"object","properties":{"state":{"type":"string","enum":["SUGGESTED","SUBMITTED","OTP_SENT","OTP_PASSED","IN_REVIEW","LINKED","DISPUTED","REJECTED","REVOKED"]},"at":{"type":"string"},"evidence":{"type":"object","additionalProperties":{},"description":"A safe subset (reason, channel, attempts, expiresAt, note): never a code, a hash, a salt or a phone number"},"decidedByClerkUserId":{"type":["string","null"]}},"required":["state","at","evidence","decidedByClerkUserId"]}},"business":{"type":["object","null"],"properties":{"id":{"type":"string"},"legalName":{"type":"string"},"tradingName":{"type":"string"},"taxIds":{"type":"object","properties":{"companyNumber":{"type":"string"},"vatNumber":{"type":"string"}},"additionalProperties":false},"clerkOrgId":{"type":"string"}},"required":["id","legalName","tradingName","taxIds","clerkOrgId"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["claimId","state","claimantClerkUserId","listing","history","business","createdAt","updatedAt"]}}},"required":["claims"]}},"required":["data"]}}}},"400":{"description":"Unknown state (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not an Onorto admin (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/gmm/claims/{claimId}/decide":{"post":{"tags":["Internal GMM Claims"],"summary":"Approve or reject a garage claim","description":"Decides a claim in review. Approving a claim whose code passed links the listing to the claim's Business. Approving a review-path claim (LANDLINE, NO_LISTED_PHONE, SMS_UNAVAILABLE), once staff have verified the claimant on the listed phone, does in one transaction what a passed code does: it creates the GB Business, the claimant's OWNER membership and a Clerk organization created by the claimant, links the listing, and records LINKED with evidence verifiedBy staff_phone; on any failure nothing is kept and the organization is deleted. Reject records the note and links nothing. The note is required.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"claimId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject"]},"note":{"type":"string","minLength":1,"maxLength":1000}},"required":["decision","note"],"additionalProperties":false}}}},"responses":{"200":{"description":"The decided claim","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"claimId":{"type":"string"},"state":{"type":"string","enum":["SUGGESTED","SUBMITTED","OTP_SENT","OTP_PASSED","IN_REVIEW","LINKED","DISPUTED","REJECTED","REVOKED"]},"claimantClerkUserId":{"type":["string","null"]},"listing":{"type":"object","properties":{"id":{"type":"string"},"siteNumber":{"type":"string"},"name":{"type":"string"},"town":{"type":"string"},"linkedBusinessId":{"type":["string","null"]}},"required":["id","siteNumber","name","town","linkedBusinessId"]},"history":{"type":"array","items":{"type":"object","properties":{"state":{"type":"string","enum":["SUGGESTED","SUBMITTED","OTP_SENT","OTP_PASSED","IN_REVIEW","LINKED","DISPUTED","REJECTED","REVOKED"]},"at":{"type":"string"},"evidence":{"type":"object","additionalProperties":{},"description":"A safe subset (reason, channel, attempts, expiresAt, note): never a code, a hash, a salt or a phone number"},"decidedByClerkUserId":{"type":["string","null"]}},"required":["state","at","evidence","decidedByClerkUserId"]}},"business":{"type":["object","null"],"properties":{"id":{"type":"string"},"legalName":{"type":"string"},"tradingName":{"type":"string"},"taxIds":{"type":"object","properties":{"companyNumber":{"type":"string"},"vatNumber":{"type":"string"}},"additionalProperties":false},"clerkOrgId":{"type":"string"}},"required":["id","legalName","tradingName","taxIds","clerkOrgId"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["claimId","state","claimantClerkUserId","listing","history","business","createdAt","updatedAt"]}},"required":["data"]}}}},"400":{"description":"Invalid body: decision other than approve or reject, or no note (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not an Onorto admin (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such claim (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"ALREADY_CLAIMED: the listing is linked by another claim (a second approve on the same listing loses); CLAIM_NOT_PENDING: the claim is not in review (approve) or is past deciding (reject)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"LISTING_DELISTED: approve on a listing that was withdrawn from the DVSA register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/int-2026/gmm/claims/{claimId}/revoke":{"post":{"tags":["Internal GMM Claims"],"summary":"Revoke a linked garage claim","description":"Unlinks a LINKED claim from its listing and records the note. Only a LINKED claim can be revoked.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"required":true,"name":"claimId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","minLength":1,"maxLength":1000}},"required":["note"],"additionalProperties":false}}}},"responses":{"200":{"description":"The revoked claim","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"claimId":{"type":"string"},"state":{"type":"string","enum":["SUGGESTED","SUBMITTED","OTP_SENT","OTP_PASSED","IN_REVIEW","LINKED","DISPUTED","REJECTED","REVOKED"]},"claimantClerkUserId":{"type":["string","null"]},"listing":{"type":"object","properties":{"id":{"type":"string"},"siteNumber":{"type":"string"},"name":{"type":"string"},"town":{"type":"string"},"linkedBusinessId":{"type":["string","null"]}},"required":["id","siteNumber","name","town","linkedBusinessId"]},"history":{"type":"array","items":{"type":"object","properties":{"state":{"type":"string","enum":["SUGGESTED","SUBMITTED","OTP_SENT","OTP_PASSED","IN_REVIEW","LINKED","DISPUTED","REJECTED","REVOKED"]},"at":{"type":"string"},"evidence":{"type":"object","additionalProperties":{},"description":"A safe subset (reason, channel, attempts, expiresAt, note): never a code, a hash, a salt or a phone number"},"decidedByClerkUserId":{"type":["string","null"]}},"required":["state","at","evidence","decidedByClerkUserId"]}},"business":{"type":["object","null"],"properties":{"id":{"type":"string"},"legalName":{"type":"string"},"tradingName":{"type":"string"},"taxIds":{"type":"object","properties":{"companyNumber":{"type":"string"},"vatNumber":{"type":"string"}},"additionalProperties":false},"clerkOrgId":{"type":"string"}},"required":["id","legalName","tradingName","taxIds","clerkOrgId"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["claimId","state","claimantClerkUserId","listing","history","business","createdAt","updatedAt"]}},"required":["data"]}}}},"400":{"description":"Invalid body: no note (VALIDATION_ERROR)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Not signed in (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Not an Onorto admin (FORBIDDEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No such claim (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CLAIM_NOT_PENDING: the claim is not LINKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"webhooks":{}}