{"openapi":"3.0.3","info":{"title":"CXVoice Integration & Setup API","version":"1.8.0","description":"Machine door for merchants. Authenticate with an API key and X-Account-Id (the merchantId). No cookies. Human docs: https://api.cxvoice.io/docs. Contract: docs/16-setup-api.md. Three kinds of key (M15): an ACCOUNT key configures its own business, every location (every key minted before M15). A SCOPED key (minted for some locations or regions/franchisees) works like a Branch manager and fails closed: lists carry only its locations, a location or node outside them is 403 location_out_of_scope, account-wide writes (profile, branding, notifications, new or archived locations, surveys, node groups, location groups) are 403, and when its locations close or its group empties it sees nothing — never everything. An ORGANISATION key is head office's: X-Account-Id names head office's own account or a live member of the organisation (each call into a member is recorded on the organisation's audit trail); GET /account lists the accounts it may name."},"servers":[{"url":"https://api.cxvoice.io","description":"Production"},{"url":"https://api-uat.cxvoice.io","description":"UAT"}],"tags":[{"name":"Account"},{"name":"Profile"},{"name":"Locations"},{"name":"Location groups"},{"name":"Review destinations"},{"name":"Surveys"},{"name":"Nodes"},{"name":"Notifications"},{"name":"Sends"},{"name":"Catalog"},{"name":"Node groups"},{"name":"Reviews"}],"security":[{"apiKey":[],"accountId":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"API key"},"accountId":{"type":"apiKey","in":"header","name":"X-Account-Id","description":"The key's own account id — or, for an organisation key, any account GET /account lists under organization.accounts."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}},"Meter":{"type":"object","properties":{"used":{"type":"integer"},"max":{"type":"integer","nullable":true},"over":{"type":"boolean"}}},"Location":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"address":{"type":"string","nullable":true},"timezone":{"type":"string","nullable":true,"description":"IANA zone; null = the account's own."},"code":{"type":"string","nullable":true,"description":"The merchant's short code for the branch, unique per account."},"external_ref":{"type":"string","nullable":true,"description":"Your own id for the branch."},"group_id":{"type":"string","nullable":true,"description":"The region or franchisee group it stands in."},"status":{"type":"string","enum":["active","archived"]},"archived_at":{"type":"string","nullable":true},"created_at":{"type":"string"}}},"LocationGroup":{"type":"object","description":"A region or franchisee inside this account. One nesting level: a group may sit under a region, nothing sits under a franchisee or under a group that has a parent.","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["region","franchisee"]},"name":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Your short code for the group, unique per account."},"parent_id":{"type":"string","nullable":true,"description":"The region this group sits in."},"sort_order":{"type":"integer"},"location_count":{"type":"integer","description":"Open locations standing directly in the group."},"created_at":{"type":"string"}}},"EscalateTo":{"type":"object","nullable":true,"description":"Who an escalation reaches. Level 1: `group_owners` (the managers holding the location's group — its franchisee); a location nobody owns that way is head office's own outlet, so the level-2 recipients stand in. Level 2: `hq` (the account's owners and admins) and `emails`.","properties":{"group_owners":{"type":"boolean"},"hq":{"type":"boolean"},"emails":{"type":"array","items":{"type":"string","format":"email"},"maxItems":20}}},"Escalation":{"type":"object","nullable":true,"description":"What applies once a location's own values, the account's and the defaults are folded together. null = no escalation.","properties":{"after":{"type":"integer","description":"Level 1 when this many Recovery responses fall in one window."},"window_hours":{"type":"integer","enum":[1,2,3,4,6,8,12,24]},"hq_after":{"type":"integer","nullable":true,"description":"Level 2 at this count; null = no head-office level."},"to":{"$ref":"#/components/schemas/EscalateTo"}}},"LocationNotifications":{"type":"object","description":"One location's alert routing (docs/27 FR-BRN-008). `configured` false = the location has no row of its own and is routed by the defaults: its Branch managers, else the account audience. `escalate_*` null = the account's value (`inherited`).","properties":{"location":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"group_id":{"type":"string","nullable":true}}},"configured":{"type":"boolean"},"recovery_alerts":{"type":"boolean"},"improve_digest":{"type":"boolean","description":"This location's own digest, to its own audience only. The account-wide digest is unaffected."},"digest_hour_local":{"type":"integer","nullable":true,"description":"null = the account's hour, in the location's zone."},"recipients":{"type":"array","items":{"type":"string"}},"user_alerts":{"type":"object","additionalProperties":{"type":"boolean"},"description":"Recorded choices by merchant user id; absent = the role's default (Branch manager on, Staff off)."},"people":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string","nullable":true},"role":{"type":"string","enum":["manager","staff"]},"alerts":{"type":"boolean"},"chosen":{"type":"boolean"}}}},"recovery_alerts_to":{"type":"object","properties":{"source":{"type":"string","enum":["location","business"]},"emails":{"type":"array","items":{"type":"string"}}}},"escalate_after":{"type":"integer","nullable":true},"escalate_window_hours":{"type":"integer","nullable":true},"escalate_hq_after":{"type":"integer","nullable":true},"escalate_to":{"$ref":"#/components/schemas/EscalateTo"},"inherited":{"type":"object"},"escalation":{"$ref":"#/components/schemas/Escalation"}}},"Destination":{"type":"object","properties":{"id":{"type":"string"},"location_id":{"type":"string"},"link_id":{"type":"string","nullable":true},"platform":{"type":"string"},"review_url":{"type":"string"},"priority":{"type":"integer"},"status":{"type":"string"}}},"Survey":{"type":"object","properties":{"id":{"type":"string"},"title":{},"status":{"type":"string"},"languages":{"type":"array","items":{"type":"string"}},"default_language":{"type":"string"},"entry_type":{"type":"string","enum":["binary","faces_5","nps_11"]},"mode":{"type":"string","enum":["simple","advanced"]},"created_at":{"type":"string"},"managed_by":{"type":"string","enum":["local","hq"],"description":"hq = a standard survey head office manages (GET /surveys/{id} only)."},"locked_fields":{"type":"array","items":{"type":"string"},"description":"While managed_by is hq: dotted paths (as the portal spells fields — routingBands, finishConfig.recovery, questions, questions.<id>.prompt, status) that survey PATCH, question writes and publish refuse with 403 survey_locked. Set on the portal only."}}},"LocationBranding":{"type":"object","description":"A location's own overrides (null = the account's value shows) and what its surveys will show.","properties":{"location_id":{"type":"string"},"branding":{"type":"object","properties":{"display_name":{"type":"string","nullable":true},"accent":{"type":"string","nullable":true},"logo_url":{"type":"string","nullable":true,"description":"Uploaded on the portal only."}}},"effective":{"type":"object","properties":{"name":{"type":"string"},"accent":{"type":"string","nullable":true},"logo_url":{"type":"string","nullable":true}}}}},"Node":{"type":"object","properties":{"id":{"type":"string"},"survey_id":{"type":"string"},"location_id":{"type":"string"},"slug":{"type":"string"},"node_slug":{"type":"string"},"label":{"type":"string"},"group_id":{"type":"string","nullable":true},"channel":{"type":"string"},"status":{"type":"string"},"created_at":{"type":"string"}}},"NodeGroup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"sort_order":{"type":"integer"},"created_at":{"type":"string"}}},"ReviewChannel":{"type":"object","description":"A connected Google Business Profile location (docs/17). `status`: connecting · active · needs_reconnect · paused · error.","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["google"]},"label":{"type":"string"},"status":{"type":"string","enum":["connecting","active","needs_reconnect","paused","error"]},"error_code":{"type":"string","nullable":true},"location_id":{"type":"string","nullable":true},"location":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"name":{"type":"string"},"address":{"type":"string","nullable":true}}},"gbp_location_name":{"type":"string","nullable":true},"average_rating":{"type":"number","nullable":true},"review_count":{"type":"integer","nullable":true},"last_synced_at":{"type":"string","nullable":true},"last_error":{"type":"string","nullable":true},"alerts_enabled":{"type":"boolean"},"digest_enabled":{"type":"boolean"},"created_at":{"type":"string"}}},"PublicReview":{"type":"object","description":"A Google review as published. Author fields are what Google shows publicly; `reply` is the CURRENT reply on Google and `reply.source` says who wrote it.","properties":{"id":{"type":"string"},"channel_id":{"type":"string"},"channel":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"label":{"type":"string"},"status":{"type":"string"},"location_id":{"type":"string","nullable":true}}},"external_id":{"type":"string"},"rating":{"type":"integer","minimum":1,"maximum":5},"author_name":{"type":"string","nullable":true},"author_anonymous":{"type":"boolean"},"text":{"type":"string","nullable":true},"language":{"type":"string","nullable":true},"review_created_at":{"type":"string"},"review_updated_at":{"type":"string"},"reply":{"type":"object","nullable":true,"properties":{"text":{"type":"string"},"at":{"type":"string","nullable":true},"source":{"type":"string","enum":["ours","google_ui"],"nullable":true}}},"reply_status":{"type":"string","enum":["unreplied","replied","pending","failed"]},"response_id":{"type":"string","nullable":true,"description":"The inquiry (case) opened from this review, if any."},"imported":{"type":"boolean","description":"Arrived through the connect-time backfill."}}}},"headers":{"Authorization":{"description":"Bearer cbk_live_… or cbk_uat_…","schema":{"type":"string"}},"X-Account-Id":{"description":"Merchant account id (merchantId). Must match the key — or, for an organisation key (M15), name head office's own account or a live member of its organisation; anything else is 403 account_mismatch. Alias: X-Merchant-Id.","schema":{"type":"string","format":"uuid"}},"Idempotency-Key":{"description":"8–120 printable ASCII characters, no spaces. Creating POSTs replay the original with replayed: true. A key outside that format is 400 invalid_idempotency_key, nothing written.","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"}}}},"paths":{"/v1/integrations/openapi.json":{"get":{"tags":["Catalog"],"summary":"OpenAPI 3 catalog","security":[],"responses":{"200":{"description":"This document","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/integrations/account":{"get":{"tags":["Account"],"summary":"Who am I / limits / usage","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string"},"limits":{"type":"string"},"usage":{"type":"object","description":"Meters { used, max, over }: locations, nodes, responses_this_month, staff_seats, review_channels — and branches (M15), the pooled ceiling across every business head office's contract pays for, present only for such a business or a plan that sets it."},"subscription":{"type":"object","nullable":true,"properties":{"status":{"type":"string","nullable":true},"trial":{"type":"boolean"},"bespoke":{"type":"boolean"},"organization_billing":{"type":"boolean","description":"Present (true) only when head office's contract pays for this business; status is then the contract's."}}},"scope":{"type":"object","description":"Present only for a SCOPED key (M15): the locations it reaches now (its own plus the open locations of its groups) and the groups it holds. Empty location_ids = it sees nothing. For a scoped key limits, usage and subscription are null — a Branch manager does not read the plan.","properties":{"location_ids":{"type":"array","items":{"type":"string"}},"group_ids":{"type":"array","items":{"type":"string"}}}},"organization":{"type":"object","description":"Present only for an ORGANISATION key (M15): head office's organisation and every live account the key may name in X-Account-Id, head office's own included. Ids and names only — no people.","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","suspended"]},"accounts":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string"},"org_role":{"type":"string","enum":["anchor","franchisee"],"nullable":true},"region_id":{"type":"string","nullable":true}}}}}}}}}}},"401":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"403":{"description":"account_mismatch · merchant_suspended · organization_suspended (an organisation key naming a member)","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/profile":{"get":{"tags":["Profile"],"summary":"Business profile","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"patch":{"tags":["Profile"],"summary":"Patch name, industry, timezone, portal_mode","requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"industry":{"type":"string","nullable":true},"timezone":{"type":"string"},"portal_mode":{"type":"string","enum":["venue","service"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"422":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/branding":{"get":{"tags":["Profile"],"summary":"Accent + logo URL","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"patch":{"tags":["Profile"],"summary":"Set accent (#rrggbb or null). Logo is portal-only.","requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"accent":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"branding_managed — head office pushed this business's brand; the accent is head office's","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/branding/accent-check":{"get":{"tags":["Profile"],"summary":"Probe accent contrast before PATCHing branding","parameters":[{"name":"accent","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/locations":{"get":{"tags":["Locations"],"summary":"List locations","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","archived","all"],"default":"all"},"description":"Archived locations are listed unless status=active."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"locations":{"type":"array","items":{"$ref":"#/components/schemas/Location"}}}}}}},"400":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"post":{"tags":["Locations"],"summary":"Create a location","description":"Counts against the plan's locations ceiling; archived locations do not.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"address":{"type":"string","nullable":true},"timezone":{"type":"string","nullable":true,"description":"IANA zone, e.g. Asia/Colombo. Empty or null = the account's."},"code":{"type":"string","nullable":true,"maxLength":40},"external_ref":{"type":"string","nullable":true,"maxLength":120},"group_id":{"type":"string","nullable":true,"description":"One of this account's location groups."}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"location":{"$ref":"#/components/schemas/Location"},"replayed":{"type":"boolean"}}}}}},"402":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"group_not_found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"code_taken","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"unknown_timezone","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/locations/{id}":{"get":{"tags":["Locations"],"summary":"One location","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"location":{"$ref":"#/components/schemas/Location"}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"patch":{"tags":["Locations"],"summary":"Patch a location","description":"name, address, timezone, code, external_ref, group_id. `status` may be echoed back unchanged; closing or reopening a branch is POST …/archive or …/restore (409 use_archive_route).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"address":{"type":"string","nullable":true},"timezone":{"type":"string","nullable":true},"code":{"type":"string","nullable":true,"maxLength":40},"external_ref":{"type":"string","nullable":true,"maxLength":120},"group_id":{"type":"string","nullable":true,"description":"One of this account's location groups; null takes it out of its group."},"status":{"type":"string","enum":["active","archived"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"location":{"$ref":"#/components/schemas/Location"}}}}}},"404":{"description":"location_not_found · group_not_found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"code_taken · use_archive_route","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"unknown_timezone","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/locations/{id}/archive":{"post":{"tags":["Locations"],"summary":"Archive (close) a location","description":"One atomic step: the location becomes archived, its active nodes are switched off (printed QR codes show the unavailable page) and recorded, and the location is removed from every user's and API key's location scope. Refused 409 scope_would_empty when that would leave someone with no location — the error lists `users` and `api_keys` — unless `reassign_to` names another active location to give them instead. Archived locations stop counting against the plan. Archiving an archived location changes nothing.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reassign_to":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"location":{"$ref":"#/components/schemas/Location"},"already_archived":{"type":"boolean"},"deactivated_nodes":{"type":"integer"},"stripped_users":{"type":"integer"},"stripped_api_keys":{"type":"integer"},"reassigned_to":{"type":"string","nullable":true},"reassigned_users":{"type":"integer"},"reassigned_api_keys":{"type":"integer"}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"scope_would_empty","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"invalid_reassign","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/locations/{id}/restore":{"post":{"tags":["Locations"],"summary":"Restore (reopen) an archived location","description":"Re-checks the plan's locations ceiling (402), then reactivates exactly the nodes the archive switched off. Location scopes are not given back. Restoring an active location changes nothing.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"location":{"$ref":"#/components/schemas/Location"},"already_active":{"type":"boolean"},"reactivated_nodes":{"type":"integer"}}}}}},"402":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/locations/{id}/notifications":{"get":{"tags":["Notifications"],"summary":"One location's alert routing, its people and the escalation that applies","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"notifications":{"$ref":"#/components/schemas/LocationNotifications"}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"patch":{"tags":["Notifications"],"summary":"Set a location's own routing (creates its row on first write)","description":"A new row starts from what applied before it (Recovery alerts as the account has them, the location digest off). `null` on an `escalate_*` field returns it to the account's value; `escalate_after: 0` switches escalation off for this location; `escalate_hq_after: 0` drops the head-office level. 422 `no_recipients` when alerts would reach nobody (the location digest never falls back to the account audience); 422 `not_at_location` (with `user_ids`) when `user_alerts` names someone who does not work there; 422 `escalation_order` / `no_escalation_recipients` when the resolved escalation makes no sense.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"recovery_alerts":{"type":"boolean"},"improve_digest":{"type":"boolean"},"digest_hour_local":{"type":"integer","minimum":0,"maximum":23,"nullable":true},"recipients":{"type":"array","items":{"type":"string","format":"email"},"maxItems":20},"user_alerts":{"type":"object","additionalProperties":{"type":"boolean"}},"escalate_after":{"type":"integer","minimum":0,"maximum":1000,"nullable":true},"escalate_window_hours":{"type":"integer","enum":[1,2,3,4,6,8,12,24],"nullable":true},"escalate_hq_after":{"type":"integer","minimum":0,"maximum":1000,"nullable":true},"escalate_to":{"$ref":"#/components/schemas/EscalateTo"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"notifications":{"$ref":"#/components/schemas/LocationNotifications"}}}}}},"400":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"delete":{"tags":["Notifications"],"summary":"Drop the location's own row: it is routed by the defaults again","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"reset":{"type":"boolean"},"notifications":{"$ref":"#/components/schemas/LocationNotifications"}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/locations/{id}/branding":{"get":{"tags":["Locations"],"summary":"A location's display name, accent and logo, with the account's as fallback","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationBranding"}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"patch":{"tags":["Locations"],"summary":"Override the display name and/or accent for this location's surveys","description":"Each field is optional; null (or an empty display_name) clears the override so the account's value shows again. An accent white text cannot be read on is refused 422 accent_unreadable with the same body as PATCH /branding (contrast, required, suggestion). The logo is a portal upload.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"display_name":{"type":"string","nullable":true,"maxLength":120},"accent":{"type":"string","nullable":true,"description":"#rrggbb"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationBranding"}}}},"400":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"403":{"description":"branding_managed — a location accent of its own while head office manages the brand","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"accent_unreadable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/location-groups":{"get":{"tags":["Location groups"],"summary":"List regions and franchisees","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"groups":{"type":"array","items":{"$ref":"#/components/schemas/LocationGroup"}}}}}}}}},"post":{"tags":["Location groups"],"summary":"Create a region or franchisee","description":"parent_id must be one of this account's regions, and that region must not itself have a parent (422 group_too_deep); a franchisee cannot contain groups (422 invalid_parent). An Idempotency-Key whose group was deleted while someone's access still names it is refused (409 idempotency_key_reused).","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["kind","name"],"properties":{"kind":{"type":"string","enum":["region","franchisee"]},"name":{"type":"string","maxLength":120},"code":{"type":"string","nullable":true,"maxLength":40},"parent_id":{"type":"string","nullable":true},"sort_order":{"type":"integer"}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"$ref":"#/components/schemas/LocationGroup"},"replayed":{"type":"boolean"}}}}}},"400":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"parent_not_found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"code_taken · idempotency_key_reused","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"group_too_deep · invalid_parent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/location-groups/{id}":{"get":{"tags":["Location groups"],"summary":"One group","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"$ref":"#/components/schemas/LocationGroup"}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"patch":{"tags":["Location groups"],"summary":"Rename, re-code, move or re-kind a group","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["region","franchisee"]},"name":{"type":"string","maxLength":120},"code":{"type":"string","nullable":true,"maxLength":40},"parent_id":{"type":"string","nullable":true},"sort_order":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"$ref":"#/components/schemas/LocationGroup"}}}}}},"400":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"group_not_found · parent_not_found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"code_taken","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"group_too_deep · invalid_parent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"delete":{"tags":["Location groups"],"summary":"Delete a group. Its locations and child groups are released, not deleted.","description":"One atomic step. The group is removed from every user's and API key's group scope; someone who held nothing else keeps the deleted id and sees no location (listed in emptied_users), never every location.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"released_locations":{"type":"integer"},"released_groups":{"type":"integer"},"stripped_users":{"type":"integer"},"stripped_api_keys":{"type":"integer"},"emptied_users":{"type":"array","items":{"type":"object"}}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/review-destinations":{"get":{"tags":["Review destinations"],"summary":"Location-level defaults","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/integrations/locations/{id}/review-destinations":{"get":{"tags":["Review destinations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"tags":["Review destinations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["platform","review_url"],"properties":{"platform":{"type":"string"},"review_url":{"type":"string"},"priority":{"type":"integer"}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/integrations/review-destinations/{id}":{"patch":{"tags":["Review destinations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"delete":{"tags":["Review destinations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/integrations/surveys":{"get":{"tags":["Surveys"],"summary":"List surveys","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"tags":["Surveys"],"summary":"Create a draft survey","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["title","entry_type","languages"],"properties":{"title":{},"entry_type":{"type":"string","enum":["binary","faces_5","nps_11"]},"languages":{"type":"array","items":{"type":"string"}},"default_language":{"type":"string"},"mode":{"type":"string","enum":["simple","advanced"]},"template_id":{"type":"string"}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/integrations/surveys/{id}":{"get":{"tags":["Surveys"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"patch":{"tags":["Surveys"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"survey_locked — the path is in error.path","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/surveys/{id}/publish":{"post":{"tags":["Surveys"],"summary":"Publish a draft (same guards as the portal)","description":"A draft made by the portal's Set up with AI holds its QR / link nodes until it is published; this call writes them and returns them in `nodes` (empty for any other survey). If they no longer fit the plan, or their location is no longer active, the survey is still published, none are written, and `nodes_not_created` says how many and why.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["survey","nodes","nodes_not_created"],"properties":{"survey":{"type":"object"},"nodes":{"type":"array","items":{"type":"object"}},"nodes_not_created":{"type":"object","nullable":true,"required":["count","code","message"],"properties":{"count":{"type":"integer"},"code":{"type":"string","enum":["limit_reached","location_unavailable"]},"message":{"type":"string"}}}}}}}},"403":{"description":"survey_locked — the path is in error.path","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/surveys/{id}/archive":{"post":{"tags":["Surveys"],"summary":"Archive a survey. Nodes, QR codes and answers are kept. New responses stop.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"survey_locked — the path is in error.path","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/surveys/{id}/restore":{"post":{"tags":["Surveys"],"summary":"Restore an archived survey to the status it had. A draft stays a draft.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"survey_locked — the path is in error.path","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/surveys/{id}/questions":{"get":{"tags":["Surveys"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"tags":["Surveys"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["type","prompt"],"properties":{"type":{"type":"string"},"prompt":{"type":"object"},"options":{"type":"object"},"show_when":{"type":"string"},"required":{"type":"boolean"}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"survey_locked — the path is in error.path","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/surveys/{id}/questions/reorder":{"post":{"tags":["Surveys"],"summary":"Reorder questions. Unlisted ids keep their relative place at the end.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"survey_locked — the path is in error.path","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/surveys/{id}/questions/{qid}":{"patch":{"tags":["Surveys"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"qid","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"survey_locked — the path is in error.path","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"delete":{"tags":["Surveys"],"summary":"Archive if live or already answered; otherwise hard-delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"qid","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"survey_locked — the path is in error.path","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/nodes":{"get":{"tags":["Nodes"],"summary":"List nodes (paginated)","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"tags":["Nodes"],"summary":"Create a QR / link node","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["survey_id","location_id","label"],"properties":{"survey_id":{"type":"string"},"location_id":{"type":"string"},"label":{"type":"string"},"node_slug":{"type":"string"},"group_id":{"type":"string"},"channel":{"type":"string","enum":["qr","link","email","sms","widget"]}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"402":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"slug_taken · location_archived · survey_not_live (a draft or archived survey; nothing written)","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/nodes/slug-available":{"get":{"tags":["Nodes"],"parameters":[{"name":"slug","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/integrations/nodes/{id}":{"patch":{"tags":["Nodes"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"409":{"description":"slug_taken · survey_not_live · location_archived (status active in an archived location)","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"delete":{"tags":["Nodes"],"summary":"Soft-delete a node. Printed slugs stay reserved.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/nodes/{id}/regenerate":{"post":{"tags":["Nodes"],"summary":"Rotate both the code and the readable slug (reprint the card)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/nodes/{id}/review-destinations":{"get":{"tags":["Review destinations"],"summary":"Node overrides and the location defaults they inherit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"post":{"tags":["Review destinations"],"summary":"Add a node-level review override","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["platform","review_url"],"properties":{"platform":{"type":"string"},"review_url":{"type":"string"},"priority":{"type":"integer"}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/integrations/node-groups":{"get":{"tags":["Node groups"],"summary":"List organisational shelves","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"tags":["Node groups"],"summary":"Create a group","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/integrations/node-groups/{id}":{"patch":{"tags":["Node groups"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"sort_order":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"delete":{"tags":["Node groups"],"summary":"Delete a group. Member nodes are released, not deleted.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/notifications":{"get":{"tags":["Notifications"],"description":"The account-wide settings, and `locations`: every location that has routing of its own (see /locations/{id}/notifications). Escalation is off until `escalate_after` is set.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}},"patch":{"tags":["Notifications"],"description":"`escalate_*` set the account-wide escalation every location inherits unless it has its own value (null clears; `escalate_after: 0` = off).","requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"recovery_alerts":{"type":"boolean"},"improve_digest":{"type":"boolean"},"notify_team":{"type":"boolean"},"digest_hour_local":{"type":"integer"},"recipients":{"type":"array","items":{"type":"string"}},"escalate_after":{"type":"integer","minimum":0,"maximum":1000,"nullable":true},"escalate_window_hours":{"type":"integer","enum":[1,2,3,4,6,8,12,24],"nullable":true},"escalate_hq_after":{"type":"integer","minimum":0,"maximum":1000,"nullable":true},"escalate_to":{"$ref":"#/components/schemas/EscalateTo"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"422":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/sends":{"post":{"tags":["Sends"],"summary":"Push one survey invitation","description":"See docs/14-integration-api.md. X-Account-Id recommended; mismatch is refused.","requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["channel","consultant","consent_attested","idempotency_key"],"properties":{"channel":{"type":"string","enum":["email","whatsapp_link"]},"consultant":{"type":"string"},"recipient":{"type":"object"},"provider_visibility":{"type":"string","enum":["named","internal"]},"consent_attested":{"type":"boolean"},"idempotency_key":{"type":"string"}}}}}},"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/update-channels":{"get":{"tags":["Surveys"],"summary":"Which update channels have a provider","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/integrations/review-channels":{"get":{"tags":["Reviews"],"summary":"List connected Google review locations with status and health","description":"docs/17 §6.2. Removed channels are not listed. `usage` is the plan meter for review channels.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"channels":{"type":"array","items":{"$ref":"#/components/schemas/ReviewChannel"}},"usage":{"$ref":"#/components/schemas/Meter"}}}}}}}}},"/v1/integrations/review-channels/connect":{"post":{"tags":["Reviews"],"summary":"Start connecting a Google Business Profile location","description":"Returns `auth_url`. A HUMAN must finish Google consent: hand the URL to the account owner, who signs in with the Google account that manages the listing and picks the location in the portal. The channel sits in `connecting` for 30 minutes, then expires. Counts against the plan's review-channel limit (402 when over). An account with more than one open location must name `location_id` (409 `location_required`), so a listing's reviews never land on a guessed branch.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"location_id":{"type":"string","description":"Your location this listing maps to. Required when the account has more than one open location; otherwise it can be set later in the portal picker."},"label":{"type":"string","maxLength":80}}}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/ReviewChannel"},"auth_url":{"type":"string"},"expires_at":{"type":"string"}}}}}},"402":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"location_required","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"503":{"description":"Review provider not configured on this environment","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/review-channels/{id}":{"patch":{"tags":["Reviews"],"summary":"Label, mapped location, alert switches, pause / resume","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","maxLength":80},"location_id":{"type":"string"},"alerts_enabled":{"type":"boolean","description":"≤ 2★ alert email for this channel"},"digest_enabled":{"type":"boolean"},"status":{"type":"string","enum":["paused","active"],"description":"Pause an active channel, or resume a paused one."}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/ReviewChannel"}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"Invalid status transition","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"delete":{"tags":["Reviews"],"summary":"Remove the channel (disconnects the Google account on the provider)","description":"Reviews already imported are kept for 90 days, then purged. Idempotent.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/public-reviews":{"get":{"tags":["Reviews"],"summary":"List Google reviews across the account's channels","description":"Newest first by default. `total` and `counts` describe the whole matching set, not the page. Public content only — what Google itself publishes.","parameters":[{"name":"rating","in":"query","schema":{"type":"string"},"description":"Comma-separated 1–5, e.g. `1,2`"},{"name":"replied","in":"query","schema":{"type":"boolean"}},{"name":"channel_id","in":"query","schema":{"type":"string"}},{"name":"from","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"has_inquiry","in":"query","schema":{"type":"boolean"}},{"name":"q","in":"query","schema":{"type":"string","maxLength":120},"description":"Text search over review text and author"},{"name":"sort","in":"query","schema":{"type":"string","enum":["newest","lowest"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PublicReview"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"counts":{"type":"object"},"channels":{"type":"array","items":{"type":"object"}}}}}}}}}},"/v1/integrations/public-reviews/{id}":{"get":{"tags":["Reviews"],"summary":"One review, our reply history, and the linked inquiry","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"review":{"$ref":"#/components/schemas/PublicReview"},"replies":{"type":"array","items":{"type":"object"},"description":"Every reply attempt, newest first, with status and actor (merchant_user or api_key)."},"inquiry":{"type":"object","nullable":true,"description":"id, status, band, assigned_to — never survey response bodies."},"can_reply":{"type":"boolean"},"reply_max_bytes":{"type":"integer"}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/public-reviews/{id}/reply":{"post":{"tags":["Reviews"],"summary":"Post or overwrite the public reply on Google","description":"Body is capped at 4,096 UTF-8 BYTES (Google's limit; ~1,300 Sinhala/Tamil characters). Conflict guard: if Google shows a reply that was not posted from here, the call answers 409 `reply_conflict` with what Google shows; send `overwrite: true` to replace it deliberately. Every attempt is recorded in the reply history with `actor.kind = api_key` and audited.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["body"],"properties":{"body":{"type":"string"},"overwrite":{"type":"boolean"},"ai_assisted":{"type":"boolean","description":"The text started from an AI draft — labelled in history (NFR-AI-003)."}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"review":{"$ref":"#/components/schemas/PublicReview"},"reply_id":{"type":"string"}}}}}},"400":{"description":"Empty body or over 4,096 bytes","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"reply_conflict · channel paused / needs_reconnect","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"410":{"description":"The author removed the review on Google","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"502":{"description":"Provider outage — the attempt is recorded as unknown; check the review before retrying","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"delete":{"tags":["Reviews"],"summary":"Delete the public reply on Google","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/public-reviews/{id}/inquiry":{"post":{"tags":["Reviews"],"summary":"Open the review as a feedback case","description":"Idempotent: one case per review; a second call returns the existing one with `created: false`. The answer is the case id and band only — survey response bodies are never exposed on this door (FR-INT-012). 409 `no_survey` when the account has no survey to take routing bands from; 409 `channel_unmapped` when the review's channel is not matched to a location and the account has more than one open location.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Already open","content":{"application/json":{"schema":{"type":"object","properties":{"response_id":{"type":"string"},"status":{"type":"string"},"created":{"type":"boolean"}}}}}},"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"response_id":{"type":"string"},"status":{"type":"string"},"band":{"type":"string"},"created":{"type":"boolean"}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/locations/bulk":{"post":{"tags":["Locations"],"summary":"Create up to 500 locations in one step","description":"One atomic step and one plan check counting only the NEW active locations (402 when they would pass the ceiling — nothing is written). Idempotent per item: an item whose `code` (else `external_ref`) already names a location here is returned as it stands with `replayed: true`; without either, the Idempotency-Key and the item's position decide its id. A re-run returns the same ids and writes nothing; the same key with a different name at a position is 409 idempotency_conflict, nothing written. `group` (CSV) or `group_code` name a region or franchisee by code. CSV columns: name, code, address, timezone, group, external_ref.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"array","items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"code":{"type":"string","nullable":true,"maxLength":40},"address":{"type":"string","nullable":true},"timezone":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"maxLength":120},"group_id":{"type":"string","nullable":true},"group_code":{"type":"string","nullable":true}}}},{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"code":{"type":"string","nullable":true,"maxLength":40},"address":{"type":"string","nullable":true},"timezone":{"type":"string","nullable":true},"external_ref":{"type":"string","nullable":true,"maxLength":120},"group_id":{"type":"string","nullable":true},"group_code":{"type":"string","nullable":true}}}},"csv":{"type":"string","description":"CSV text with a header row."}}}]}},"text/csv":{"schema":{"type":"string","description":"A header row naming the columns, then one row per item."}}}},"responses":{"200":{"description":"Every item already existed: nothing written, replayed: true","content":{"application/json":{"schema":{"type":"object"}}}},"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"locations":{"type":"array","items":{"$ref":"#/components/schemas/Location"}},"created":{"type":"integer","description":"Items written by this call."},"existing":{"type":"integer","description":"Items that already existed and were returned unchanged."},"replayed":{"type":"boolean","description":"True when nothing was written (every item already existed)."}}}}}},"400":{"description":"invalid_request · invalid_csv","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"402":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"code_taken · idempotency_conflict","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"invalid_items · too_many_items · no_items","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"rows":{"type":"array","description":"422 invalid_items: every row that needs fixing. `row` is 1-based; `line` is the CSV line (header = 1).","items":{"type":"object","properties":{"row":{"type":"integer"},"line":{"type":"integer"},"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"429":{"description":"rate_limited — only the request's own unit was spent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/nodes/bulk":{"post":{"tags":["Nodes"],"summary":"Create up to 1,000 numbered nodes across locations in one step","description":"Each item is one location × a numbered range: labels are `{prefix} {from}` … `{prefix} {to}`. At most 1,000 nodes per call in all (422 too_many_nodes). One atomic step and one plan check: refused as a whole (402) when the new nodes would pass the ceiling. Readable slugs are derived from the labels and kept unique across the call. `survey_id`, `group_id` and `channel` may be sent once beside `items`. With an Idempotency-Key, node n of the call gets the same id on every retry, so a replay returns the same nodes with `replayed: true` — only while node n is still that location and label; otherwise 409 idempotency_conflict and nothing is written. Each node carries `url` (/{business}/{node_slug}) and `qr_url` (/{slug}, what the QR encodes). 409 location_archived when an item names a closed branch, 409 survey_not_live when one names a draft or archived survey (the whole call; nothing written).","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"array","items":{"type":"object","required":["prefix","from","to"],"properties":{"location_id":{"type":"string"},"location_code":{"type":"string"},"prefix":{"type":"string","maxLength":60},"from":{"type":"integer","minimum":1},"to":{"type":"integer","minimum":1},"survey_id":{"type":"string"},"channel":{"type":"string","enum":["qr","link","email","sms","widget"]},"group_id":{"type":"string","nullable":true}}}},{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","required":["prefix","from","to"],"properties":{"location_id":{"type":"string"},"location_code":{"type":"string"},"prefix":{"type":"string","maxLength":60},"from":{"type":"integer","minimum":1},"to":{"type":"integer","minimum":1},"survey_id":{"type":"string"},"channel":{"type":"string","enum":["qr","link","email","sms","widget"]},"group_id":{"type":"string","nullable":true}}}},"csv":{"type":"string","description":"CSV text with a header row."},"survey_id":{"type":"string","description":"The survey for every item that names none."},"group_id":{"type":"string","nullable":true},"channel":{"type":"string","enum":["qr","link","email","sms","widget"]}}}]}},"text/csv":{"schema":{"type":"string","description":"A header row naming the columns, then one row per item."}}}},"responses":{"200":{"description":"Every node already existed: nothing written, replayed: true","content":{"application/json":{"schema":{"type":"object"}}}},"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"nodes":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Node"},{"type":"object","properties":{"url":{"type":"string"},"qr_url":{"type":"string"},"row":{"type":"integer"},"replayed":{"type":"boolean"}}}]}},"created":{"type":"integer","description":"Items written by this call."},"existing":{"type":"integer","description":"Items that already existed and were returned unchanged."},"replayed":{"type":"boolean","description":"True when nothing was written (every item already existed)."}}}}}},"400":{"description":"invalid_request · invalid_csv","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"402":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"location_archived · survey_not_live · idempotency_conflict","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"invalid_items · too_many_nodes · no_items","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"429":{"description":"rate_limited — only the request's own unit was spent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/locations/{id}/qr-pack":{"get":{"tags":["Locations"],"summary":"Print manifest for one location: its name, logo and every live node's addresses","description":"Live nodes only (a paused or deleted code shows the unavailable page). `url` is the readable address set under the code on a card; `qr_url` is what the QR encodes. `logo_url` is the location's own logo, else the account's, else null. Print the branch as `location.name` and the business as `business.display_name`: a location's display name replaces the business name (often the same franchisee name at every branch), so it does not tell branches apart.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"location":{"$ref":"#/components/schemas/Location"},"business":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string","description":"The name the business goes by at this location (its display name, else `name`): what the survey header shows."}}},"logo_url":{"type":"string","nullable":true},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"slug":{"type":"string"},"node_slug":{"type":"string"},"url":{"type":"string"},"qr_url":{"type":"string"},"channel":{"type":"string"},"survey_id":{"type":"string"}}}}}}}}},"404":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}},"/v1/integrations/review-destinations/bulk":{"post":{"tags":["Review destinations"],"summary":"Add location-level review links to many locations in one step","description":"Same fields as POST /locations/{id}/review-destinations plus the location (`location_id` or `location_code`). Priorities are assigned in order after each location's existing links. A link the location already has live (same platform and URL) is returned with `replayed: true` and not added twice. With an Idempotency-Key, link n replays only while it is still that location, platform and URL (else 409 idempotency_conflict, nothing written). At most 500 per call.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":120,"pattern":"^[\\x21-\\x7E]{8,120}$"},"description":"8–120 printable ASCII characters (letters, digits, punctuation; no spaces). Replay returns the original with replayed: true. A key outside that format is 400 invalid_idempotency_key with nothing written — never read as no key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"array","items":{"type":"object","required":["platform","review_url"],"properties":{"location_id":{"type":"string"},"location_code":{"type":"string"},"platform":{"type":"string"},"review_url":{"type":"string"}}}},{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","required":["platform","review_url"],"properties":{"location_id":{"type":"string"},"location_code":{"type":"string"},"platform":{"type":"string"},"review_url":{"type":"string"}}}},"csv":{"type":"string","description":"CSV text with a header row."}}}]}},"text/csv":{"schema":{"type":"string","description":"A header row naming the columns, then one row per item."}}}},"responses":{"200":{"description":"Every link already existed: nothing written, replayed: true","content":{"application/json":{"schema":{"type":"object"}}}},"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"destinations":{"type":"array","items":{"$ref":"#/components/schemas/Destination"}},"created":{"type":"integer","description":"Items written by this call."},"existing":{"type":"integer","description":"Items that already existed and were returned unchanged."},"replayed":{"type":"boolean","description":"True when nothing was written (every item already existed)."}}}}}},"400":{"description":"invalid_request · invalid_csv","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"409":{"description":"idempotency_conflict","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"422":{"description":"invalid_items · too_many_items · no_items","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"429":{"description":"rate_limited — only the request's own unit was spent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}}}}