{"openapi":"3.1.0","info":{"title":"Softrivo API","version":"1.0","summary":"Connect your own software to your Softrivo WhatsApp assistant.","description":"The Softrivo API lets the software a business runs (a clinic system, a CRM,\na property or car stock system, a website) read and change what its\nWhatsApp assistant knows and does: appointments, leads, free times,\ncustomers and their conversations, sending a WhatsApp message, the\nknowledge files the assistant answers from, the service menu, listings,\nand the webhook endpoints that receive events.\n\n**Authentication.** Every request carries `Authorization: Bearer <key>`.\nKeys are created on the dashboard's Integrations page. An `sk_live_` key\nworks on the business itself; an `sk_test_` key works on a private\nsandbox copy of the business (no WhatsApp number, so nothing it does\nreaches a customer). The same code works with both.\n\n**Permissions.** A key may be limited to scopes. A request outside the\nkey's scopes answers `403 insufficient_scope`.\n\n**Errors.** Every error is `{ error, code, request_id }`; `request_id` is\nalso in the `X-Request-Id` header. Quote it when asking for help.\n\n**Paging.** Lists answer `{ data, limit, offset, next_cursor }`. Pass\n`cursor=<next_cursor>` for the next page (newest first); when it is null\nthere is no more. Catalog lists page by `offset` only.\n\n**Idempotency.** Send `Idempotency-Key: <unique string>` on any POST or\nPATCH; the first answer is replayed for 24 hours (`Idempotent-Replayed:\ntrue`), so a retry never books or sends twice.\n\n**Rate limit.** 120 requests a minute per key unless agreed otherwise;\nover it answers `429 rate_limited` with `RateLimit-*` headers.\n","contact":{"name":"Softrivo","url":"https://softrivo.com/developers/","email":"contact@softrivo.com"},"termsOfService":"https://app.softrivo.com/legal"},"servers":[{"url":"https://api.softrivo.com/api/v1","description":"Production (live and sandbox keys)"}],"security":[{"apiKey":[]}],"tags":[{"name":"Appointments"},{"name":"Leads"},{"name":"Availability"},{"name":"Customers"},{"name":"Conversations"},{"name":"Messages"},{"name":"Knowledge"},{"name":"Services"},{"name":"Listings"},{"name":"Webhooks"},{"name":"WhatsApp"}],"paths":{"/appointments":{"get":{"tags":["Appointments"],"operationId":"listAppointments","summary":"List appointments","description":"Newest first. Scope `read:appointments`.","parameters":[{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/AppointmentStatus"}},{"name":"location_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","description":"Only appointments scheduled at or after this date or ISO timestamp.","schema":{"type":"string"}},{"name":"to","in":"query","description":"Only appointments scheduled before this date or ISO timestamp.","schema":{"type":"string"}},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/cursor"}],"responses":{"200":{"description":"A page of appointments.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Appointment"}}}}]}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Appointments"],"operationId":"createAppointment","summary":"Book an appointment","description":"Scope `write:appointments`. The same path as a WhatsApp or phone\nbooking: an exact date and time are required, the double-booking guard\napplies, the owner gets the usual alert, and a customer's open future\nbooking is moved instead of duplicated (then the answer is 200 with\n`rescheduled: true`).\n","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentCreate"}}}},"responses":{"200":{"description":"The customer's open booking was moved to this time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentResult"}}}},"201":{"description":"Booked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentResult"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"description":"`slot_full` (that time is fully booked) or `closed` (the branch is closed then).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/IdempotencyReused"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/appointments/{id}":{"parameters":[{"$ref":"#/components/parameters/id"}],"get":{"tags":["Appointments"],"operationId":"getAppointment","summary":"Read one appointment","description":"Scope `read:appointments`.","responses":{"200":{"description":"The appointment.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Appointment"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Appointments"],"operationId":"updateAppointment","summary":"Confirm, decline, cancel or move an appointment","description":"Scope `write:appointments`. Sending `date` and `time` moves it (the slot\nguard applies). `status` may be confirmed, declined or cancelled;\nconfirming needs a date and time. Emits `appointment.updated`.\n","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentUpdate"}}}},"responses":{"200":{"description":"The updated appointment.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Appointment"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"`slot_full` or `closed`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/IdempotencyReused"}}}},"/leads":{"get":{"tags":["Leads"],"operationId":"listLeads","summary":"List leads","description":"Newest first. Scope `read:leads`.","parameters":[{"name":"since","in":"query","description":"Leads created at or after this date or ISO timestamp.","schema":{"type":"string"}},{"name":"score","in":"query","schema":{"type":"string","enum":["hot","warm","cold"]}},{"name":"status","in":"query","schema":{"type":"string"}},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/cursor"}],"responses":{"200":{"description":"A page of leads.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}}}}]}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/availability":{"get":{"tags":["Availability"],"operationId":"getAvailability","summary":"Free appointment times","description":"Scope `read:availability`. Only a branch with a booking calendar answers\nslots; otherwise `{ configured: false, slots: [] }`.\n","parameters":[{"name":"location_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":31,"default":7}},{"name":"from","in":"query","description":"First day (YYYY-MM-DD).","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"The open slots.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Availability"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/customers":{"get":{"tags":["Customers"],"operationId":"listCustomers","summary":"List customers","description":"Everyone who has messaged the business on WhatsApp, newest first, with\ntheir latest lead. Scope `read:customers`.\n","parameters":[{"name":"since","in":"query","description":"Customers whose last message is at or after this date or ISO timestamp.","schema":{"type":"string"}},{"name":"handler","in":"query","schema":{"type":"string","enum":["bot","human"]}},{"name":"location_id","in":"query","schema":{"type":"string","format":"uuid"}},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/cursor"}],"responses":{"200":{"description":"A page of customers.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}}}]}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/customers/{id}":{"parameters":[{"$ref":"#/components/parameters/customerId"}],"get":{"tags":["Customers"],"operationId":"getCustomer","summary":"Read one customer","description":"Scope `read:customers`.","responses":{"200":{"description":"The customer.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Customer"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/conversations/{id}/messages":{"parameters":[{"$ref":"#/components/parameters/customerId"}],"get":{"tags":["Conversations"],"operationId":"listMessages","summary":"A customer's conversation","description":"Newest first, exactly as the dashboard inbox shows it. Scope\n`read:conversations`. One stored turn can hold the customer's message\nand the assistant's reply, so a page may carry more messages than\n`limit`. Files customers sent that are stored privately are never\nlinked (`media_url` null, `media_private` true).\n","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/cursor"}],"responses":{"200":{"description":"A page of messages.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}}}]}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/messages":{"post":{"tags":["Messages"],"operationId":"sendMessage","summary":"Send a WhatsApp message to a customer","description":"Scope `write:messages`. Sent from the business's number (the branch the\ncustomer wrote to). WhatsApp only allows free text within 24 hours of\nthe customer's last message; outside it the answer is `409\nwindow_closed`. A sandbox (test key) has no number: `409\nno_whatsapp_number`, nothing is sent. The message is saved so the\nassistant sees it as context. The thread's handler changes only when\n`handler` is sent: `human` hands the customer to a person (the assistant\nstops replying until handed back), `bot` hands back.\n","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageSend"}}}},"responses":{"201":{"description":"Sent.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SentMessage"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"description":"`window_closed` (with `last_customer_message_at`) or `no_whatsapp_number`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/IdempotencyReused"},"502":{"description":"`send_failed`: WhatsApp did not accept the message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/knowledge/files":{"get":{"tags":["Knowledge"],"operationId":"listKnowledgeFiles","summary":"List knowledge files","description":"The documents the assistant answers from, newest first. Scope `read:knowledge`.","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/cursor"}],"responses":{"200":{"description":"A page of files.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeFile"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Knowledge"],"operationId":"uploadKnowledgeFile","summary":"Upload a knowledge file","description":"Scope `write:knowledge`. pdf, docx, xlsx, xls or txt, up to 25 MB, as\nmultipart form data (`file`) or JSON (`filename`, `content_base64`).\nThe file is processed in the background: `status` is `processing`\nuntil the text is indexed, then `ready` or `error`. A file whose name\nhas the same base as an existing one (for example `price_list_v2.pdf`\nafter `price_list_v1.pdf`) replaces it; `replaced` lists the removed\nids. `location_id` limits the file to one branch.\n","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"location_id":{"type":"string","format":"uuid"}}}},"application/json":{"schema":{"type":"object","required":["filename","content_base64"],"properties":{"filename":{"type":"string","examples":["opening_hours.txt"]},"content_base64":{"type":"string","description":"The file's bytes","base64.":null},"location_id":{"type":"string","format":"uuid"}}}}}},"responses":{"201":{"description":"Accepted and processing.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/KnowledgeFile"},"replaced":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Ids of older versions removed."}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"`insufficient_scope`, or `storage_limit` (with `used_kb`, `limit_kb`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"$ref":"#/components/responses/NotEnabled"},"413":{"description":"`file_too_large`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/IdempotencyReused"}}}},"/knowledge/files/{id}":{"parameters":[{"$ref":"#/components/parameters/id"}],"get":{"tags":["Knowledge"],"operationId":"getKnowledgeFile","summary":"Read one file and its status","description":"Scope `read:knowledge`.","responses":{"200":{"description":"The file.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/KnowledgeFile"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Knowledge"],"operationId":"deleteKnowledgeFile","summary":"Remove a file","description":"Removes the file and everything the assistant learned from it. Scope `write:knowledge`.","responses":{"200":{"description":"Removed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/services":{"get":{"tags":["Services"],"operationId":"listServices","summary":"List the service menu","description":"Scope `read:catalog`. Pages by offset; `next_cursor` is always null.","parameters":[{"name":"active","in":"query","schema":{"type":"boolean"}},{"name":"location_id","in":"query","schema":{"type":"string","format":"uuid"}},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"}],"responses":{"200":{"description":"The services.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Service"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/NotEnabled"}}},"post":{"tags":["Services"],"operationId":"createService","summary":"Add a service","description":"Scope `write:catalog`. The assistant quotes prices only from this menu.","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceInput"}}}},"responses":{"201":{"description":"Added.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Service"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/IdempotencyReused"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/services/{id}":{"parameters":[{"$ref":"#/components/parameters/id"}],"get":{"tags":["Services"],"operationId":"getService","summary":"Read one service","description":"Scope `read:catalog`.","responses":{"200":{"description":"The service.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Service"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/NotEnabled"}}},"patch":{"tags":["Services"],"operationId":"updateService","summary":"Change a service","description":"Scope `write:catalog`. Any subset of the fields; `active: true` restores an archived service.","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceInput"}}}},"responses":{"200":{"description":"Changed.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Service"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/IdempotencyReused"},"503":{"$ref":"#/components/responses/NotEnabled"}}},"delete":{"tags":["Services"],"operationId":"archiveService","summary":"Archive a service","description":"Sets `active` to false; never a hard delete. Scope `write:catalog`.","responses":{"200":{"description":"Archived.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Archived"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/listings":{"get":{"tags":["Listings"],"operationId":"listListings","summary":"List listings (property or vehicle stock)","description":"Active listings, most recently changed first. Scope `read:catalog`. Pages by offset.","parameters":[{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/ListingStatus"}},{"name":"kind","in":"query","schema":{"$ref":"#/components/schemas/ListingKind"}},{"name":"location_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"q","in":"query","description":"Text search over ref code","title":null,"area":null,"project":null,"type":null,"make":null,"model":null,"variant.":null,"schema":{"type":"string","maxLength":100}},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"}],"responses":{"200":{"description":"The listings.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Listing"}}}}]}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/NotEnabled"}}},"post":{"tags":["Listings"],"operationId":"createListing","summary":"Add a listing","description":"Scope `write:catalog`. The assistant offers only listings from here, by ref code.","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListingInput"}}}},"responses":{"201":{"description":"Added.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Listing"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"description":"`duplicate_ref_code`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/IdempotencyReused"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/listings/{id}":{"parameters":[{"$ref":"#/components/parameters/id"}],"get":{"tags":["Listings"],"operationId":"getListing","summary":"Read one listing","description":"Scope `read:catalog`.","responses":{"200":{"description":"The listing.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Listing"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/NotEnabled"}}},"patch":{"tags":["Listings"],"operationId":"updateListing","summary":"Change a listing","description":"Scope `write:catalog`. Any subset of the fields (for example `status: sold`).","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListingInput"}}}},"responses":{"200":{"description":"Changed.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Listing"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"`duplicate_ref_code`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/IdempotencyReused"},"503":{"$ref":"#/components/responses/NotEnabled"}}},"delete":{"tags":["Listings"],"operationId":"archiveListing","summary":"Archive a listing","description":"Sets `active` to false; never a hard delete. Scope `write:catalog`.","responses":{"200":{"description":"Archived.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Archived"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/webhooks":{"get":{"tags":["Webhooks"],"operationId":"listWebhooks","summary":"List webhook endpoints","description":"Scope `write:webhooks`. Secrets are never listed.","responses":{"200":{"description":"The endpoints and the events that exist.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}},"events":{"type":"array","items":{"$ref":"#/components/schemas/EventName"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/NotEnabled"}}},"post":{"tags":["Webhooks"],"operationId":"createWebhook","summary":"Add a webhook endpoint","description":"Scope `write:webhooks`. The URL must be https on a public host. The\nsigning `secret` is returned in this answer only: store it, it is what\n`verifyWebhookSignature` checks deliveries with. Up to 10 endpoints.\n","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"}}}},"responses":{"201":{"description":"Added, with the secret (this once only).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpoint"},"secret":{"type":"string","examples":["whsec_3kQ..."]}}}}}},"400":{"description":"`validation_error`, or `limit_reached` (10 endpoints).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/IdempotencyReused"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/webhooks/{id}":{"parameters":[{"$ref":"#/components/parameters/id"}],"get":{"tags":["Webhooks"],"operationId":"getWebhook","summary":"Read one endpoint","description":"Scope `write:webhooks`.","responses":{"200":{"description":"The endpoint.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpoint"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/NotEnabled"}}},"patch":{"tags":["Webhooks"],"operationId":"updateWebhook","summary":"Change an endpoint","description":"Scope `write:webhooks`. `active: false` pauses deliveries at once.","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"$ref":"#/components/schemas/EventName"}},"active":{"type":"boolean"},"description":"{ type: string, maxLength: 200 }"}}}}},"responses":{"200":{"description":"Changed.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpoint"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/IdempotencyReused"},"503":{"$ref":"#/components/responses/NotEnabled"}}},"delete":{"tags":["Webhooks"],"operationId":"deleteWebhook","summary":"Remove an endpoint","description":"Scope `write:webhooks`.","responses":{"200":{"description":"Removed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/webhooks/{id}/test":{"parameters":[{"$ref":"#/components/parameters/id"}],"post":{"tags":["Webhooks"],"operationId":"testWebhook","summary":"Send a signed test event","description":"One `ping` delivery to the endpoint, sent now, no retries. Scope `write:webhooks`.","responses":{"200":{"description":"What happened.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"ok":{"type":"boolean"},"delivery_id":{"type":"string","format":"uuid"},"response_status":{"type":["integer","null"]},"error":{"type":["string","null"]}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/webhooks/{id}/deliveries":{"parameters":[{"$ref":"#/components/parameters/id"}],"get":{"tags":["Webhooks"],"operationId":"listWebhookDeliveries","summary":"Recent deliveries to an endpoint","description":"Newest first. Scope `write:webhooks`.","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/cursor"}],"responses":{"200":{"description":"A page of deliveries.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}}}}]}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/whatsapp/connect-sessions":{"post":{"tags":["WhatsApp"],"operationId":"createWhatsappConnectSession","summary":"Create a WhatsApp connect link","description":"Scope `write:whatsapp`. Returns a one-time `url` the business owner\nopens to connect a WhatsApp number through Meta Embedded Signup, with no\nSoftrivo login. Send the url to the owner; the token is in the url and is\nshown this once only. A test key makes a sandbox link that completes as a\nsimulation, so no real number is connected.\n","parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectLinkInput"}}}},"responses":{"201":{"description":"The link, with its one-time url.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConnectLinkCreated"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/IdempotencyReused"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/whatsapp/connect-sessions/{id}":{"parameters":[{"$ref":"#/components/parameters/id"}],"get":{"tags":["WhatsApp"],"operationId":"getWhatsappConnectSession","summary":"Read a connect link's status","description":"Scope `read:whatsapp`. `status` is pending, completed, failed or\nexpired. Once completed, `result` holds the connected number's safe\ndetails (never a token, WABA id or phone number id). Poll this, or use\nthe SDK's `waitForConnection`.\n","responses":{"200":{"description":"The connect link.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ConnectSession"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/NotEnabled"}}}},"/whatsapp/numbers":{"get":{"tags":["WhatsApp"],"operationId":"listWhatsappNumbers","summary":"List connected WhatsApp numbers","description":"Scope `read:whatsapp`. The business's connected numbers and their\nstatus. A sandbox (test key) has none. Never includes a token, WABA id\nor phone number id.\n","responses":{"200":{"description":"The connected numbers.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WhatsAppNumber"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"description":"`server_error`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"appointment.created":{"post":{"summary":"A booking was made (on WhatsApp, by phone, on the dashboard or by API).","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"appointment.created"},"data":{"$ref":"#/components/schemas/AppointmentPayload"}}}]}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds. Otherwise we retry after 1 min","5 min":null,"30 min":null,"2 h and 6 h.":null}}}},"appointment.updated":{"post":{"summary":"A booking was confirmed, declined, cancelled, moved or edited.","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"appointment.updated"},"data":{"allOf":[{"$ref":"#/components/schemas/AppointmentPayload"},{"type":"object","properties":{"change":{"type":"string","enum":["confirmed","declined","cancelled","rescheduled","edited"]},"source":{"type":"string","examples":["api","dashboard","whatsapp"]}}}]}}}]}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds."}}}},"lead.created":{"post":{"summary":"A new lead was captured from a conversation.","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"lead.created"},"data":{"$ref":"#/components/schemas/LeadPayload"}}}]}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds."}}}},"call.completed":{"post":{"summary":"A WhatsApp call ended (answered by the assistant, or missed).","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebhookEnvelope"},{"type":"object","properties":{"event":{"const":"call.completed"},"data":{"$ref":"#/components/schemas/CallPayload"}}}]}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds."}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"sk_live_… or sk_test_…","description":"An API key from the dashboard's Integrations page. Never put it in a web page or mobile app."}},"parameters":{"id":{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},"customerId":{"name":"id","in":"path","required":true,"description":"The customer's phone number with country code (any formatting) or their WhatsApp username id, as returned in `Customer.id`.","schema":{"type":"string","examples":["60123456789","MY.1453000111222"]}},"limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},"offset":{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}},"cursor":{"name":"cursor","in":"query","description":"The `next_cursor` of the previous page.","schema":{"type":"string"}},"idempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Any unique string up to 255 characters. The first answer is replayed for 24 hours.","schema":{"type":"string","maxLength":255}}},"responses":{"ValidationError":{"description":"`validation_error`: a field is missing or wrong; `error` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"`missing_api_key` or `invalid_api_key`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"`insufficient_scope` (with `required_scope`): the key does not have this permission.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"`not_found`: no such record for this business.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"IdempotencyReused":{"description":"`idempotency_key_reused`: this Idempotency-Key was already used for a different request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"`rate_limited`: over the key's limit; wait for the `RateLimit-Reset` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotEnabled":{"description":"`not_enabled`: this feature is not switched on for the business yet.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error","code","request_id"],"properties":{"error":{"type":"string","description":"A sentence for a person."},"code":{"type":"string","description":"A stable code for a program.","enum":["validation_error","missing_api_key","invalid_api_key","api_not_enabled","sandbox_unavailable","insufficient_scope","not_found","rate_limited","idempotency_key_invalid","idempotency_key_reused","slot_full","closed","window_closed","no_whatsapp_number","send_failed","storage_limit","file_too_large","not_enabled","limit_reached","duplicate_ref_code","server_error"]},"request_id":{"type":"string","format":"uuid"},"required_scope":{"type":"string","description":"On `insufficient_scope`."},"reason":{"type":"string","description":"On a booking refusal."},"migration_pending":{"type":"boolean","description":"On `not_enabled`."}}},"Page":{"type":"object","required":["data","limit","offset","next_cursor"],"properties":{"data":{"type":"array","items":{}},"limit":{"type":"integer"},"offset":{"type":"integer"},"next_cursor":{"type":["string","null"],"description":"Pass as `cursor` for the next page; null when there is no more."}}},"Deleted":{"type":"object","properties":{"deleted":{"type":"boolean","const":true},"id":{"type":"string","format":"uuid"}}},"Archived":{"type":"object","properties":{"archived":{"type":"boolean","const":true},"id":{"type":"string","format":"uuid"}}},"AppointmentStatus":{"type":"string","enum":["pending","confirmed","declined","cancelled"]},"AppointmentPayload":{"type":"object","description":"The appointment as every webhook and list carries it (services/events.appointmentPayload).","properties":{"id":{"type":"string","format":"uuid"},"status":{"$ref":"#/components/schemas/AppointmentStatus"},"customer_name":{"type":["string","null"]},"phone":{"type":["string","null"],"description":"Digits with country code."},"service":{"type":["string","null"]},"date":{"type":["string","null"],"format":"date"},"time":{"type":["string","null"],"examples":["2:30 PM"]},"scheduled_at":{"type":["string","null"],"format":"date-time"},"location_id":{"type":["string","null"],"format":"uuid"},"notes":{"type":["string","null"]}}},"Appointment":{"allOf":[{"$ref":"#/components/schemas/AppointmentPayload"},{"type":"object","properties":{"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}}}]},"AppointmentCreate":{"type":"object","required":["phone","date","time"],"properties":{"phone":{"type":"string","description":"With country code, for example 60123456789.","examples":["60123456789"]},"name":{"type":"string","maxLength":120},"service":{"type":"string","maxLength":200},"date":{"type":"string","format":"date","examples":["2026-12-01"]},"time":{"type":"string","description":"14:30 or 2:30 PM","examples":["14:30"]},"location_id":{"type":"string","format":"uuid"},"notes":{"type":"string","maxLength":1000}}},"AppointmentUpdate":{"type":"object","properties":{"status":{"type":"string","enum":["confirmed","declined","cancelled"]},"date":{"type":"string","format":"date"},"time":{"type":"string"},"name":{"type":"string","maxLength":120},"service":{"type":"string","maxLength":200},"notes":{"type":"string","maxLength":1000}}},"AppointmentResult":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Appointment"},"rescheduled":{"type":"boolean","description":"True when the customer's open booking was moved instead of a new one made."}}},"LeadPayload":{"type":"object","description":"The lead as every webhook and list carries it (services/events.leadPayload).","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"interest":{"type":["string","null"]},"score":{"type":["string","null"],"enum":["hot","warm","cold",null]},"status":{"type":["string","null"]},"appointment_request":{"type":["string","null"]},"location_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":["string","null"],"format":"date-time"}}},"Lead":{"allOf":[{"$ref":"#/components/schemas/LeadPayload"},{"type":"object","properties":{"updated_at":{"type":["string","null"],"format":"date-time"}}}]},"Availability":{"type":"object","properties":{"configured":{"type":"boolean"},"location_id":{"type":"string","format":"uuid"},"time_zone":{"type":"string","examples":["Asia/Kuala_Lumpur"]},"slot_minutes":{"type":"integer"},"capacity":{"type":"integer"},"from":{"type":"string","format":"date"},"days":{"type":"integer"},"slots":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"time":{"type":"string","examples":["10:30 AM"]},"minutes":{"type":"integer","description":"Minutes after midnight."},"start":{"type":"string","format":"date-time"},"remaining":{"type":"integer","description":"How many bookings this time can still take."}}}}}},"Customer":{"type":"object","properties":{"id":{"type":"string","description":"The phone number as digits","or the WhatsApp username id. Use it in the customer and conversation routes and in `MessageSend.to`.":null},"phone":{"type":["string","null"],"description":"Digits with country code; null for a username customer."},"username_id":{"type":["string","null"],"description":"Set when the customer hides their number behind a WhatsApp username."},"name":{"type":["string","null"]},"contact_label":{"type":["string","null"]},"handler":{"type":"string","enum":["bot","human","closed"]},"unread_count":{"type":"integer"},"last_message":{"type":["string","null"]},"last_message_at":{"type":["string","null"],"format":"date-time"},"last_customer_message_at":{"type":["string","null"],"format":"date-time"},"window_open":{"type":"boolean","description":"Whether a free-text message can be sent now (customer wrote within 24 h)."},"lead":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"score":{"type":["string","null"]},"status":{"type":["string","null"]},"interest":{"type":["string","null"]}}},"location_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":["string","null"],"format":"date-time"}}},"Message":{"type":"object","properties":{"id":{"type":"string"},"from":{"type":"string","enum":["customer","bot","owner"]},"text":{"type":["string","null"]},"media_url":{"type":["string","null"],"format":"uri"},"media_type":{"type":["string","null"],"examples":["image","document","audio"]},"media_private":{"type":"boolean","description":"True when the customer's file is stored privately and not linked here."},"created_at":{"type":"string","format":"date-time"}}},"MessageSend":{"type":"object","required":["to","text"],"properties":{"to":{"type":"string","description":"A phone number with country code, or a Customer.id.","examples":["60123456789"]},"text":{"type":"string","maxLength":4096},"handler":{"type":"string","enum":["human","bot"],"description":"Optional. `human` hands the customer to a person; `bot` hands back."}}},"SentMessage":{"type":"object","properties":{"id":{"type":["string","null"],"format":"uuid"},"to":{"type":"string"},"text":{"type":"string"},"handler":{"type":"string","enum":["bot","human","closed"]},"created_at":{"type":"string","format":"date-time"}}},"KnowledgeFile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"filename":{"type":["string","null"]},"type":{"type":["string","null"],"enum":["pdf","docx","xlsx","xls","txt",null]},"size_kb":{"type":["integer","null"]},"status":{"type":"string","enum":["processing","ready","error","unknown"]},"chunks_count":{"type":"integer"},"error":{"type":["string","null"]},"location_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":["string","null"],"format":"date-time"}}},"Service":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"location_id":{"type":["string","null"],"format":"uuid","description":"null = every branch."},"name":{"type":"string"},"duration_minutes":{"type":"integer"},"price":{"type":["number","null"]},"price_note":{"type":["string","null"],"examples":["from RM80"]},"active":{"type":"boolean"},"sort":{"type":"integer"}}},"ServiceInput":{"type":"object","properties":{"name":{"type":"string","maxLength":120,"description":"Required when creating."},"duration_minutes":{"type":"integer","minimum":5,"maximum":480,"default":30},"price":{"type":["number","null"]},"price_note":{"type":["string","null"],"maxLength":200},"active":{"type":"boolean","default":true},"sort":{"type":"integer","default":0},"location_id":{"type":["string","null"],"format":"uuid"}}},"ListingKind":{"type":"string","enum":["property","vehicle","other"]},"ListingStatus":{"type":"string","enum":["available","reserved","sold","rented"]},"Listing":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"location_id":{"type":["string","null"],"format":"uuid"},"kind":{"$ref":"#/components/schemas/ListingKind"},"ref_code":{"type":["string","null"]},"title":{"type":"string"},"status":{"$ref":"#/components/schemas/ListingStatus"},"price":{"type":["number","null"]},"price_period":{"type":"string","enum":["sale","month"]},"area":{"type":["string","null"]},"project":{"type":["string","null"]},"property_type":{"type":["string","null"]},"bedrooms":{"type":["integer","null"]},"bathrooms":{"type":["integer","null"]},"size_sqft":{"type":["integer","null"]},"make":{"type":["string","null"]},"model":{"type":["string","null"]},"variant":{"type":["string","null"]},"year":{"type":["integer","null"]},"mileage_km":{"type":["integer","null"]},"condition":{"type":["string","null"],"enum":["new","used","recond",null]},"description":"{ type: [string, \"null\"] }","url":{"type":["string","null"],"format":"uri"},"agent_id":{"type":["string","null"],"format":"uuid"},"updated_at":{"type":["string","null"],"format":"date-time"}}},"ListingInput":{"type":"object","properties":{"title":{"type":"string","maxLength":200,"description":"Required when creating."},"kind":{"$ref":"#/components/schemas/ListingKind"},"ref_code":{"type":"string","maxLength":60},"status":{"$ref":"#/components/schemas/ListingStatus"},"price":{"oneOf":[{"type":"number"},{"type":"string"}],"description":"A number, or text like \"650k\", \"1.2m\", \"RM 650,000\"."},"price_period":{"type":"string","enum":["sale","month"]},"area":{"type":"string","maxLength":120},"project":{"type":"string","maxLength":160},"property_type":{"type":"string","maxLength":60},"bedrooms":{"type":"integer","minimum":0,"maximum":50},"bathrooms":{"type":"integer","minimum":0,"maximum":50},"size_sqft":{"type":"integer","minimum":0},"make":{"type":"string","maxLength":60},"model":{"type":"string","maxLength":80},"variant":{"type":"string","maxLength":80},"year":{"type":"integer","minimum":1950,"maximum":2100},"mileage_km":{"type":"integer","minimum":0},"condition":{"type":"string","enum":["new","used","recond"]},"description":"{ type: string, maxLength: 2000 }","url":{"type":"string","format":"uri","maxLength":500},"agent_id":{"type":["string","null"],"format":"uuid","description":"One of your team members."},"location_id":{"type":["string","null"],"format":"uuid"}}},"EventName":{"type":"string","enum":["appointment.created","appointment.updated","lead.created","call.completed"]},"WebhookInput":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","description":"https on a public host."},"events":{"type":"array","items":{"$ref":"#/components/schemas/EventName"},"description":"Default is every event."},"description":"{ type: string, maxLength: 200 }"}},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"$ref":"#/components/schemas/EventName"}},"active":{"type":"boolean"},"description":"{ type: [string, \"null\"] }","created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}}},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Also sent as the `X-Softrivo-Delivery` header."},"endpoint_id":{"type":"string","format":"uuid"},"event":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"integer"},"response_status":{"type":["integer","null"]},"last_error":{"type":["string","null"]},"next_attempt_at":{"type":["string","null"],"format":"date-time"},"delivered_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"WebhookEnvelope":{"type":"object","description":"Every delivery is a POST with this JSON body and the headers\n`X-Softrivo-Event` (the event name), `X-Softrivo-Delivery` (a unique id,\nuse it to skip repeats) and `X-Softrivo-Signature`: `sha256=` + the\nHMAC-SHA256 hex of the raw body, keyed with the endpoint's secret.\n","required":["id","event","created_at","data"],"properties":{"id":{"type":"string","format":"uuid"},"event":{"$ref":"#/components/schemas/EventName"},"created_at":{"type":"string","format":"date-time"},"data":{"type":"object"}}},"CallPayload":{"type":"object","properties":{"call_id":{"type":["string","null"]},"caller_phone":{"type":["string","null"]},"location_id":{"type":["string","null"],"format":"uuid"},"answered":{"type":"boolean"},"missed":{"type":"boolean","description":"Present and true on a missed call."},"ring_seconds":{"type":["number","null"],"description":"On a missed call."},"ended_reason":{"type":["string","null"]},"turns":{"type":["integer","null"]},"escalated":{"type":"boolean"},"booking":{"type":["object","null"],"properties":{"saved":{"type":"boolean"},"appointment_id":{"type":["string","null"],"format":"uuid"}}},"ended_at":{"type":"string","format":"date-time"}}},"ConnectLinkInput":{"type":"object","properties":{"location_id":{"type":"string","format":"uuid","description":"The branch this number is for. Omit for the business's first number."},"return_url":{"type":"string","format":"uri","description":"An https link the page offers as \"Back to the app\" afterwards."},"expires_in_minutes":{"type":"integer","minimum":5,"maximum":1440,"default":60,"description":"How long the link works."}}},"ConnectLinkCreated":{"type":"object","required":["id","url","status","mode","expires_at"],"properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri","description":"The one-time link to send the owner. The token is in the fragment and shown only here."},"status":{"type":"string","enum":["pending"]},"mode":{"type":"string","enum":["live","test"]},"location_id":{"type":["string","null"],"format":"uuid"},"expires_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"ConnectSession":{"type":"object","required":["id","status","mode"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","completing","completed","failed","expired"]},"mode":{"type":"string","enum":["live","test"]},"location_id":{"type":["string","null"],"format":"uuid"},"return_url":{"type":["string","null"],"format":"uri"},"result":{"type":["object","null"],"description":"Safe details once completed; null until then.","properties":{"connection_status":{"type":"string","examples":["active","pending_meta_permissions","simulated"]},"phone_number":{"type":["string","null"]},"display_name":{"type":["string","null"]},"is_coexistence":{"type":"boolean"},"simulated":{"type":"boolean","description":"True for a sandbox (test) link."}}},"error_code":{"type":["string","null"],"description":"On a failed link","why.":null},"expires_at":{"type":["string","null"],"format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"WhatsAppNumber":{"type":"object","required":["id","status"],"properties":{"id":{"type":"string","format":"uuid"},"phone_number":{"type":["string","null"],"examples":["60123456789"]},"display_name":{"type":["string","null"]},"status":{"type":"string","enum":["active","pending","disconnected"]},"is_coexistence":{"type":"boolean","description":"True when the number stays on the WhatsApp Business app."},"location_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":"string","format":"date-time"}}}}}}