{"openapi":"3.1.0","info":{"title":"Sayvara API","version":"8ac707f8b80e6cdda16ba4bffb6ea0e30b30c81c","description":"Arabic-first closed-loop customer feedback. Errors carry a stable `code`; the apps translate it."},"servers":[{"url":"https://api.sayvara.ai"}],"paths":{"/health":{"get":{"tags":["health"],"summary":"Readiness (database reachable)","operationId":"getHealth","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/health/live":{"get":{"tags":["health"],"summary":"Liveness","operationId":"getHealthLive","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/signup":{"post":{"tags":["auth"],"summary":"Create an organisation and its owner; emails a link that confirms the address in this browser. 400 PASSWORD_BREACHED: the password is in a known data breach","operationId":"postV1AuthSignup","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"email":{"type":"string","maxLength":254},"password":{"type":"string","minLength":12,"maxLength":256},"name":{"type":"string","minLength":1,"maxLength":200},"organisation":{"type":"string","minLength":1,"maxLength":200},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"locale":{"default":"ar","type":"string","enum":["ar","en"]}},"required":["email","password","name","organisation","country"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/login":{"post":{"tags":["auth"],"summary":"Email and password sign-in; sets the session cookie (an unconfirmed address: 403 EMAIL_NOT_VERIFIED, mails a confirmation and sets the confirmation cookie of this browser)","operationId":"postV1AuthLogin","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"email":{"type":"string","maxLength":254},"password":{"type":"string","minLength":1,"maxLength":256}},"required":["email","password"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/magic-link":{"post":{"tags":["auth"],"summary":"Email a single-use sign-in link","operationId":"postV1AuthMagicLink","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"email":{"type":"string","maxLength":254}},"required":["email"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/magic-link/consume":{"post":{"tags":["auth"],"summary":"Sign in with a link token; sets the session cookie (reads the confirmation cookie; clears it when the token was a confirmation)","operationId":"postV1AuthMagicLinkConsume","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/logout":{"post":{"tags":["auth"],"summary":"End this session","description":"Also works before the MFA check.","operationId":"postV1AuthLogout","security":[{"session":[]}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/entra/status":{"get":{"tags":["auth"],"summary":"Whether Microsoft sign-in is configured (the sign-in page shows the button only then)","operationId":"getV1AuthEntraStatus","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/entra/start":{"get":{"tags":["auth"],"summary":"Start Microsoft sign-in: the Microsoft URL; sets a short flow cookie (501 until configured)","operationId":"getV1AuthEntraStart","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/entra/callback":{"post":{"tags":["auth"],"summary":"Finish Microsoft sign-in with the returned code and state; sets the session cookie","operationId":"postV1AuthEntraCallback","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","minLength":10,"maxLength":4096,"pattern":"^[A-Za-z0-9._~\\-/+=]+$"},"state":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}},"required":["code","state"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/password/forgot":{"post":{"tags":["auth"],"summary":"Email a single-use password reset link (30 min)","operationId":"postV1AuthPasswordForgot","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"email":{"type":"string","maxLength":254}},"required":["email"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/password/reset":{"post":{"tags":["auth"],"summary":"Set a new password with a reset link token; ends every session. 400 PASSWORD_BREACHED: the password is in a known data breach (the link stays usable)","operationId":"postV1AuthPasswordReset","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"},"password":{"type":"string","minLength":12,"maxLength":256}},"required":["token","password"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/invites/preview":{"post":{"tags":["auth"],"summary":"What an invite link is for (organisation, role, whether the account exists)","operationId":"postV1AuthInvitesPreview","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/invites/accept":{"post":{"tags":["auth"],"summary":"Accept an invite (new accounts set name and password; a WhatsApp invite signed out also sets email, creates the account unconfirmed and answers confirmEmail: true); sets the session cookie. 400 PASSWORD_BREACHED: the new account password is in a known data breach","operationId":"postV1AuthInvitesAccept","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"},"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","maxLength":254},"password":{"type":"string","minLength":12,"maxLength":256}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/me":{"get":{"tags":["auth"],"summary":"The signed-in user, session strength and organisations","description":"Also works before the MFA check.","operationId":"getV1Me","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/mfa/totp/setup":{"post":{"tags":["mfa"],"summary":"Start authenticator app setup (secret + otpauth URL)","operationId":"postV1AuthMfaTotpSetup","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/mfa/totp/enable":{"post":{"tags":["mfa"],"summary":"Confirm the first code; returns recovery codes once","operationId":"postV1AuthMfaTotpEnable","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["code"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/mfa/totp/disable":{"post":{"tags":["mfa"],"summary":"Turn the authenticator app off. 409 BREAK_GLASS_MFA_REQUIRED when it is your last second factor and you are the break-glass account of an organisation that requires single sign-on","operationId":"postV1AuthMfaTotpDisable","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["code"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/mfa/whatsapp/enroll":{"post":{"tags":["mfa"],"summary":"Send a WhatsApp code to a new phone number","operationId":"postV1AuthMfaWhatsappEnroll","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"phone":{"type":"string","pattern":"^\\+[1-9]\\d{6,14}$"}},"required":["phone"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/mfa/whatsapp/confirm":{"post":{"tags":["mfa"],"summary":"Confirm the phone with its code; turns WhatsApp MFA on","operationId":"postV1AuthMfaWhatsappConfirm","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["code"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/mfa/whatsapp/send":{"post":{"tags":["mfa"],"summary":"Send a sign-in code to the verified phone","description":"Also works before the MFA check.","operationId":"postV1AuthMfaWhatsappSend","security":[{"session":[]}],"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/mfa/verify":{"post":{"tags":["mfa"],"summary":"Pass two-step verification for this session","description":"Also works before the MFA check.","operationId":"postV1AuthMfaVerify","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"method":{"type":"string","enum":["totp","whatsapp","recovery"]},"code":{"type":"string","minLength":6,"maxLength":20}},"required":["method","code"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/passkeys":{"get":{"tags":["mfa"],"summary":"The account's passkeys (name, added, last used), whether it has another second factor and whether one of its organisations requires MFA","operationId":"getV1AuthPasskeys","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["mfa"],"summary":"Add the passkey (counts as this session's MFA check; emails a notice; audited mfa.webauthn.enabled); returns the list","operationId":"postV1AuthPasskeys","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"response":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":1400,"pattern":"^[A-Za-z0-9_-]+$"},"rawId":{"type":"string","minLength":1,"maxLength":1400,"pattern":"^[A-Za-z0-9_-]+$"},"type":{"type":"string","const":"public-key"},"authenticatorAttachment":{"type":"string","enum":["platform","cross-platform"]},"clientExtensionResults":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"response":{"type":"object","properties":{"clientDataJSON":{"type":"string","minLength":1,"maxLength":4096,"pattern":"^[A-Za-z0-9_-]+$"},"attestationObject":{"type":"string","minLength":1,"maxLength":16384,"pattern":"^[A-Za-z0-9_-]+$"},"authenticatorData":{"type":"string","minLength":1,"maxLength":8192,"pattern":"^[A-Za-z0-9_-]+$"},"transports":{"maxItems":8,"type":"array","items":{"type":"string","enum":["ble","cable","hybrid","internal","nfc","smart-card","usb"]}},"publicKeyAlgorithm":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"publicKey":{"type":"string","minLength":1,"maxLength":4096,"pattern":"^[A-Za-z0-9_-]+$"}},"required":["clientDataJSON","attestationObject"]}},"required":["id","rawId","type","response"]}},"required":["name","response"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/passkeys/register/options":{"post":{"tags":["mfa"],"summary":"WebAuthn creation options for a new passkey (user verification required; 403 RECENT_SIGN_IN_REQUIRED after 10 minutes, 403 IDP_SESSION_NOT_ALLOWED)","operationId":"postV1AuthPasskeysRegisterOptions","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/passkeys/{id}":{"delete":{"tags":["mfa"],"summary":"Remove a passkey (recent sign-in; emails a notice; audited mfa.webauthn.removed); returns the list","operationId":"deleteV1AuthPasskeysId","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/passkeys/mfa/options":{"post":{"tags":["mfa"],"summary":"WebAuthn request options for this account's passkeys, as the second factor (409 MFA_METHOD_NOT_ENABLED)","description":"Also works before the MFA check.","operationId":"postV1AuthPasskeysMfaOptions","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/passkeys/mfa/verify":{"post":{"tags":["mfa"],"summary":"Pass two-step verification with a passkey (401 PASSKEY_NOT_ACCEPTED)","description":"Also works before the MFA check.","operationId":"postV1AuthPasskeysMfaVerify","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"response":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":1400,"pattern":"^[A-Za-z0-9_-]+$"},"rawId":{"type":"string","minLength":1,"maxLength":1400,"pattern":"^[A-Za-z0-9_-]+$"},"type":{"type":"string","const":"public-key"},"authenticatorAttachment":{"type":"string","enum":["platform","cross-platform"]},"clientExtensionResults":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"response":{"type":"object","properties":{"clientDataJSON":{"type":"string","minLength":1,"maxLength":4096,"pattern":"^[A-Za-z0-9_-]+$"},"authenticatorData":{"type":"string","minLength":1,"maxLength":8192,"pattern":"^[A-Za-z0-9_-]+$"},"signature":{"type":"string","minLength":1,"maxLength":2048,"pattern":"^[A-Za-z0-9_-]+$"},"userHandle":{"type":"string","minLength":1,"maxLength":256,"pattern":"^[A-Za-z0-9_-]+$"}},"required":["clientDataJSON","authenticatorData","signature"]}},"required":["id","rawId","type","response"]}},"required":["response"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/passkeys/unlock/options":{"post":{"tags":["mfa"],"summary":"WebAuthn request options to re-unlock the installed app with one of this account's passkeys (409 MFA_METHOD_NOT_ENABLED)","operationId":"postV1AuthPasskeysUnlockOptions","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/passkeys/unlock":{"post":{"tags":["mfa"],"summary":"Re-unlock the installed app: only the session user's own passkey; records a fresh check on the session and rotates its cookie (401 PASSKEY_NOT_ACCEPTED; audited auth.unlocked / auth.unlock_failed)","operationId":"postV1AuthPasskeysUnlock","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"response":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":1400,"pattern":"^[A-Za-z0-9_-]+$"},"rawId":{"type":"string","minLength":1,"maxLength":1400,"pattern":"^[A-Za-z0-9_-]+$"},"type":{"type":"string","const":"public-key"},"authenticatorAttachment":{"type":"string","enum":["platform","cross-platform"]},"clientExtensionResults":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"response":{"type":"object","properties":{"clientDataJSON":{"type":"string","minLength":1,"maxLength":4096,"pattern":"^[A-Za-z0-9_-]+$"},"authenticatorData":{"type":"string","minLength":1,"maxLength":8192,"pattern":"^[A-Za-z0-9_-]+$"},"signature":{"type":"string","minLength":1,"maxLength":2048,"pattern":"^[A-Za-z0-9_-]+$"},"userHandle":{"type":"string","minLength":1,"maxLength":256,"pattern":"^[A-Za-z0-9_-]+$"}},"required":["clientDataJSON","authenticatorData","signature"]}},"required":["id","rawId","type","response"]}},"required":["response"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/session/lock":{"put":{"tags":["mfa"],"summary":"The device's app lock for this session in minutes (0: none); refused with 423 APP_LOCKED while the session is locked, so it never lowers or clears a lock","operationId":"putV1AuthSessionLock","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"minutes":{"type":"integer","minimum":0,"maximum":1440}},"required":["minutes"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["mfa"],"summary":"Lock this session now: every route but GET /v1/me, the passkey unlock and sign-out answers 423 APP_LOCKED until a passkey unlock","operationId":"postV1AuthSessionLock","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/session/activity":{"post":{"tags":["mfa"],"summary":"The person is using the app (sent at most once a minute while active): refreshes the session's last use so the server's time lock does not fire; 423 APP_LOCKED while locked, so it never clears or delays a lock","operationId":"postV1AuthSessionActivity","security":[{"session":[]}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/passkeys/sign-in/options":{"post":{"tags":["mfa"],"summary":"WebAuthn request options for a sign-in with a discoverable passkey (no address needed)","operationId":"postV1AuthPasskeysSignInOptions","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/passkeys/sign-in":{"post":{"tags":["mfa"],"summary":"Sign in with a passkey: opens a session whose MFA check is passed (amr webauthn; audited auth.passkey.sign_in)","operationId":"postV1AuthPasskeysSignIn","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"response":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":1400,"pattern":"^[A-Za-z0-9_-]+$"},"rawId":{"type":"string","minLength":1,"maxLength":1400,"pattern":"^[A-Za-z0-9_-]+$"},"type":{"type":"string","const":"public-key"},"authenticatorAttachment":{"type":"string","enum":["platform","cross-platform"]},"clientExtensionResults":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"response":{"type":"object","properties":{"clientDataJSON":{"type":"string","minLength":1,"maxLength":4096,"pattern":"^[A-Za-z0-9_-]+$"},"authenticatorData":{"type":"string","minLength":1,"maxLength":8192,"pattern":"^[A-Za-z0-9_-]+$"},"signature":{"type":"string","minLength":1,"maxLength":2048,"pattern":"^[A-Za-z0-9_-]+$"},"userHandle":{"type":"string","minLength":1,"maxLength":256,"pattern":"^[A-Za-z0-9_-]+$"}},"required":["clientDataJSON","authenticatorData","signature"]}},"required":["id","rawId","type","response"]}},"required":["response"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}":{"get":{"tags":["tenants"],"summary":"Organisation settings","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["tenants"],"summary":"Change organisation settings. mfaRequired (true only) follows PUT /security/mfa-required: 403 OWNER_ONLY, 409 OWN_MFA_FIRST","description":"Permission: `tenant.update`.","operationId":"patchV1TenantsTenantId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"defaultLocale":{"type":"string","enum":["ar","en"]},"mfaRequired":{"type":"boolean","const":true}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/profile":{"get":{"tags":["tenants"],"summary":"Organisation profile: name, country, default language, time zone","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdProfile","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"orgProfileView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/profile/legal":{"get":{"tags":["tenants"],"summary":"Legal acceptance history: terms, DPA and privacy notice versions, who and when, newest first","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdProfileLegal","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"orgLegalView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit":{"get":{"tags":["tenants"],"summary":"Activity log, newest first: filters for person, area, action, unit and dates; cursor paging","description":"Permission: `activity.read`.","operationId":"getV1TenantsTenantIdAudit","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"before","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{1,17}_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"actorType","in":"query","required":false,"schema":{"type":"string","enum":["user","api_key","system","public","integration","staff_support","platform_staff"]}},{"name":"actorId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100}},{"name":"area","in":"query","required":false,"schema":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,47}$"}},{"name":"action","in":"query","required":false,"schema":{"type":"string","pattern":"^[a-z][a-z0-9_.:-]{0,99}$"}},{"name":"unitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/facets":{"get":{"tags":["tenants"],"summary":"Activity counts per area, action and person for the same filters","description":"Permission: `activity.read`.","operationId":"getV1TenantsTenantIdAuditFacets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"actorType","in":"query","required":false,"schema":{"type":"string","enum":["user","api_key","system","public","integration","staff_support","platform_staff"]}},{"name":"actorId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100}},{"name":"area","in":"query","required":false,"schema":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,47}$"}},{"name":"action","in":"query","required":false,"schema":{"type":"string","pattern":"^[a-z][a-z0-9_.:-]{0,99}$"}},{"name":"unitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/views":{"get":{"tags":["audit"],"summary":"Who viewed which response, contact or ticket, newest first","description":"Permission: `audit.read`.","operationId":"getV1TenantsTenantIdAuditViews","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"targetType","in":"query","required":false,"schema":{"type":"string","enum":["response","contact","ticket","conversation"]}},{"name":"targetId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"viewerId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":128}},{"name":"before","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/views/retention":{"get":{"tags":["audit"],"summary":"How long view records are kept (days)","description":"Permission: `audit.read`.","operationId":"getV1TenantsTenantIdAuditViewsRetention","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["audit"],"summary":"Set how long view records are kept (30 to 3650 days); 202 pending_approval when the organisation needs approval for retention changes (applied on approval)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdAuditViewsRetention","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"days":{"type":"integer","minimum":30,"maximum":3650}},"required":["days"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/chain":{"get":{"tags":["audit"],"summary":"Hash chain head and the last verification","description":"Permission: `audit.read`.","operationId":"getV1TenantsTenantIdAuditChain","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/chain/verify":{"post":{"tags":["audit"],"summary":"Verify the hash chain now; reports the first break","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdAuditChainVerify","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ChainVerification"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/export":{"get":{"tags":["audit"],"summary":"Chained audit rows in seq order with their hashes (JSON pages; CSV with format=csv; one CEF line per row with format=cef)","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAuditExport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"auditExportQuery","response":"AuditExportPage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/sinks":{"get":{"tags":["audit"],"summary":"SIEM sinks (Microsoft Sentinel, Splunk, syslog over TLS); never the secret","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAuditSinks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"SiemSinkView[]"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/sinks/{kind}":{"put":{"tags":["audit"],"summary":"Create or change a SIEM sink; the secret goes to the Secrets seam","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdAuditSinksKind","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"siemSinkInput","response":"SiemSinkView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts siemSinkInput"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["audit"],"summary":"Remove a SIEM sink and its secret","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdAuditSinksKind","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/sinks/syslog/preview":{"get":{"tags":["audit"],"summary":"The newest CEF lines in the syslog sink format (limit 1-50): the audit rows the sink sends, and the sign-in, two-step and SSO events of members, which this preview shows and the sink does not send","description":"Permission: `audit.read`.","operationId":"getV1TenantsTenantIdAuditSinksSyslogPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/audit/sinks/syslog/test":{"post":{"tags":["audit"],"summary":"Send one test event to the saved syslog collector; answers ok (closed: the collector closed cleanly after reading), or code BLOCKED_HOST or BLOCKED_PORT (the saved host or port is not allowed here) or UNREACHABLE (any other failure) (6 per 10 minutes)","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdAuditSinksSyslogTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/incidents":{"get":{"tags":["audit"],"summary":"Incidents that concern this organisation, once it was told","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPrivacyIncidents","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"TenantIncidentList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-units":{"get":{"tags":["org"],"summary":"Organisation tree","description":"Permission: `org.read`.","operationId":"getV1TenantsTenantIdOrgUnits","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["org"],"summary":"Add a region, branch or team","description":"Permission: `org.write`.","operationId":"postV1TenantsTenantIdOrgUnits","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"parentId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string","enum":["region","branch","team"]},"nameEn":{"type":"string","minLength":1,"maxLength":200},"nameAr":{"type":"string","minLength":1,"maxLength":200},"code":{"anyOf":[{"type":"string","minLength":1,"maxLength":40,"pattern":"^[\\p{L}\\p{N}][\\p{L}\\p{N} ._/-]*$"},{"type":"null"}]},"timezone":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]}},"required":["parentId","nameEn","nameAr"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-units/{unitId}":{"patch":{"tags":["org"],"summary":"Rename a unit or move it under another parent (members whose scope changes are re-scoped at once)","description":"Permission: `org.write`.","operationId":"patchV1TenantsTenantIdOrgUnitsUnitId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"unitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nameEn":{"type":"string","minLength":1,"maxLength":200},"nameAr":{"type":"string","minLength":1,"maxLength":200},"parentId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"code":{"anyOf":[{"type":"string","minLength":1,"maxLength":40,"pattern":"^[\\p{L}\\p{N}][\\p{L}\\p{N} ._/-]*$"},{"type":"null"}]},"timezone":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["org"],"summary":"Archive a unit with no live units under it (kept for history)","description":"Permission: `org.write`.","operationId":"deleteV1TenantsTenantIdOrgUnitsUnitId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"unitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-units/levels":{"get":{"tags":["org"],"summary":"Organisation levels: labels EN/AR per kind, unit counts, whether a template may be applied","description":"Permission: `org.read`.","operationId":"getV1TenantsTenantIdOrgUnitsLevels","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["org"],"summary":"Save 2-4 levels (company first, kinds going down). 409 LEVEL_IN_USE when a unit kind would lose its level","description":"Permission: `org.write`.","operationId":"putV1TenantsTenantIdOrgUnitsLevels","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"levels":{"minItems":2,"maxItems":4,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["company","region","branch","team"]},"labelEn":{"type":"string","minLength":1,"maxLength":60},"labelAr":{"type":"string","minLength":1,"maxLength":60}},"required":["kind","labelEn","labelAr"],"additionalProperties":false}}},"required":["levels"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-units/levels/template":{"post":{"tags":["org"],"summary":"Apply a level template while no unit sits below the company (409 TREE_NOT_EMPTY)","description":"Permission: `org.write`.","operationId":"postV1TenantsTenantIdOrgUnitsLevelsTemplate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"template":{"type":"string","enum":["enterprise","government","bank","retail","contact_centre"]}},"required":["template"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/members":{"get":{"tags":["members"],"summary":"Members and roles","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdMembers","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/members/invites":{"get":{"tags":["members"],"summary":"Open invites and those accepted or revoked in the last 30 days","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdMembersInvites","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["members"],"summary":"Invite a person by email (or by WhatsApp phone, channel \"whatsapp\", once available) with a role and scope (link valid 7 days)","description":"Permission: `members.write`.","operationId":"postV1TenantsTenantIdMembersInvites","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"email":{"type":"string","maxLength":254},"role":{"type":"string","enum":["owner","admin","manager","agent","analyst","viewer","caller","supervisor"]},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"locale":{"type":"string","enum":["ar","en"]},"channel":{"type":"string","const":"email"}},"required":["email","role"],"additionalProperties":false},{"type":"object","properties":{"channel":{"type":"string","const":"whatsapp"},"phone":{"type":"string","minLength":3,"maxLength":40},"role":{"type":"string","enum":["owner","admin","manager","agent","analyst","viewer","caller","supervisor"]},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"locale":{"type":"string","enum":["ar","en"]}},"required":["channel","phone","role"],"additionalProperties":false}]}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/members/invite-channels":{"get":{"tags":["members"],"summary":"Invite channels that work now: email always, WhatsApp once its template is approved","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdMembersInviteChannels","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/members/invites/{inviteId}/resend":{"post":{"tags":["members"],"summary":"Send a new invite link (the old one stops working)","description":"Permission: `members.write`.","operationId":"postV1TenantsTenantIdMembersInvitesInviteIdResend","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"inviteId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/members/invites/{inviteId}":{"delete":{"tags":["members"],"summary":"Revoke an open invite","description":"Permission: `members.write`.","operationId":"deleteV1TenantsTenantIdMembersInvitesInviteId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"inviteId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/members/invites/bulk/preview":{"post":{"tags":["members"],"summary":"Check a CSV of invites (email, name, role, unit): every row with its errors; sends nothing","description":"Permission: `members.write`.","operationId":"postV1TenantsTenantIdMembersInvitesBulkPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"csv":{"type":"string","minLength":1,"maxLength":110000},"locale":{"type":"string","enum":["ar","en"]}},"required":["csv"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/members/invites/bulk":{"post":{"tags":["members"],"summary":"Send the rows of the CSV that have no errors (checked again on the server); the outcome per row","description":"Permission: `members.write`.","operationId":"postV1TenantsTenantIdMembersInvitesBulk","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"csv":{"type":"string","minLength":1,"maxLength":110000},"locale":{"type":"string","enum":["ar","en"]}},"required":["csv"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso":{"get":{"tags":["sso"],"summary":"Single sign-on: the Entra, Google, OIDC and SAML connections and the claimed domains","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdSso","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/entra":{"put":{"tags":["sso"],"summary":"Connect the Entra directory (tenant id) of the organisation. 409 SSO_REQUIRED_STOP_FIRST for another directory while single sign-on is required","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSsoEntra","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"entraTenantId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["entraTenantId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["sso"],"summary":"Disconnect Microsoft sign-in. 409 SSO_REQUIRED_STOP_FIRST while single sign-on is required","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdSsoEntra","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/domains":{"post":{"tags":["sso"],"summary":"Claim an email domain; answers the TXT record to publish","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdSsoDomains","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"domain":{"type":"string","maxLength":253,"pattern":"^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"}},"required":["domain"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/domains/{domainId}/verify":{"post":{"tags":["sso"],"summary":"Check the TXT record now and mark the domain verified","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdSsoDomainsDomainIdVerify","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"domainId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/domains/{domainId}":{"delete":{"tags":["sso"],"summary":"Remove a domain claim. 409 SSO_REQUIRED_STOP_FIRST for a verified domain while single sign-on is required","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdSsoDomainsDomainId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"domainId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/google/status":{"get":{"tags":["auth"],"summary":"Whether Google Workspace sign-in is configured (the sign-in page shows the button only then)","operationId":"getV1AuthGoogleStatus","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/google/start":{"get":{"tags":["auth"],"summary":"Start Google Workspace sign-in: the Google URL; sets a short flow cookie (501 until configured)","operationId":"getV1AuthGoogleStart","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/google/callback":{"post":{"tags":["auth"],"summary":"Finish Google sign-in with the returned code and state; sets the session cookie","operationId":"postV1AuthGoogleCallback","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","minLength":4,"maxLength":4096,"pattern":"^[A-Za-z0-9._~\\-/+=%*!]+$"},"state":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}},"required":["code","state"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/sso/discover":{"post":{"tags":["auth"],"summary":"Single sign-on methods of the organisation that verified this address's domain","operationId":"postV1AuthSsoDiscover","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"email":{"type":"string","maxLength":254}},"required":["email"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/oidc/{connectionId}/start":{"get":{"tags":["auth"],"summary":"Start sign-in through the organisation's OIDC provider; sets a short flow cookie","operationId":"getV1AuthOidcConnectionIdStart","security":[],"parameters":[{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/oidc/callback":{"post":{"tags":["auth"],"summary":"Finish OIDC sign-in with the returned code and state; sets the session cookie (a link flow answers `linked` and keeps the session)","operationId":"postV1AuthOidcCallback","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","minLength":4,"maxLength":4096,"pattern":"^[A-Za-z0-9._~\\-/+=%*!]+$"},"state":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}},"required":["code","state"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/saml/{connectionId}/metadata":{"get":{"tags":["auth"],"summary":"SAML service provider metadata (XML) for the IdP administrator","operationId":"getV1AuthSamlConnectionIdMetadata","security":[],"parameters":[{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/saml/{connectionId}/start":{"get":{"tags":["auth"],"summary":"Start SAML sign-in: the IdP URL (HTTP-Redirect AuthnRequest); sets a short flow cookie","operationId":"getV1AuthSamlConnectionIdStart","security":[],"parameters":[{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/saml/{connectionId}/acs":{"post":{"tags":["auth"],"summary":"Assertion consumer service (HTTP-POST binding, form-encoded SAMLResponse and RelayState); 303 to the app","operationId":"postV1AuthSamlConnectionIdAcs","security":[],"parameters":[{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"303":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/saml/complete":{"post":{"tags":["auth"],"summary":"Finish SAML sign-in with the one-time ticket from the ACS; sets the session cookie (a link flow answers `linked` and keeps the session)","operationId":"postV1AuthSamlComplete","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"ticket":{"type":"string","pattern":"^[A-Za-z0-9_-]{40,8192}$"}},"required":["ticket"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/google":{"put":{"tags":["sso"],"summary":"Turn on Google Workspace sign-in (default role, auto-join)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSsoGoogle","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"defaultRole":{"default":"agent","type":"string","enum":["manager","agent"]},"autoJoin":{"default":false,"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["sso"],"summary":"Turn off Google Workspace sign-in","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdSsoGoogle","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/oidc":{"put":{"tags":["sso"],"summary":"Connect an OIDC provider (issuer, client id, write-only client secret)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSsoOidc","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"issuer":{"type":"string","maxLength":512,"format":"uri"},"clientId":{"type":"string","minLength":1,"maxLength":255},"clientSecret":{"type":"string","minLength":8,"maxLength":2048},"defaultRole":{"default":"agent","type":"string","enum":["manager","agent"]},"autoJoin":{"default":false,"type":"boolean"}},"required":["issuer","clientId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["sso"],"summary":"Disconnect the OIDC provider (its secret, SCIM tokens and groups go too)","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdSsoOidc","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/saml":{"put":{"tags":["sso"],"summary":"Connect a SAML 2.0 IdP (entity id, sign-in URL, signing certificates; left out on an edit, the stored ones stay)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSsoSaml","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"idpEntityId":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^\\S+$"},"ssoUrl":{"type":"string","maxLength":512,"format":"uri"},"certificates":{"minItems":1,"maxItems":3,"type":"array","items":{"type":"string","maxLength":8192,"pattern":"^-----BEGIN CERTIFICATE-----\\s+[A-Za-z0-9+/=\\s]+-----END CERTIFICATE-----\\s*$"}},"defaultRole":{"default":"agent","type":"string","enum":["manager","agent"]},"autoJoin":{"default":false,"type":"boolean"}},"required":["idpEntityId","ssoUrl"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["sso"],"summary":"Disconnect the SAML IdP (its SCIM tokens and groups go too). 409 SSO_REQUIRED_STOP_FIRST while single sign-on is required (also for Google, OIDC and LDAP, for a save of an existing OIDC, SAML or LDAP connection that changes more than its default role or auto-join, and for turning requireMappedGroup on)","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdSsoSaml","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/link/oidc/start":{"post":{"tags":["sso"],"summary":"Owners and admins: consent to and start linking your own account to the OIDC provider (recent two-step-verified session); the provider URL and a 5-minute link flow cookie","description":"Permission: `tenant.read`.","operationId":"postV1TenantsTenantIdSsoLinkOidcStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"consent":{"type":"boolean","const":true}},"required":["consent"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/link/saml/start":{"post":{"tags":["sso"],"summary":"Owners and admins: consent to and start linking your own account to the SAML IdP (recent two-step-verified session); the IdP URL and a 5-minute link flow cookie","description":"Permission: `tenant.read`.","operationId":"postV1TenantsTenantIdSsoLinkSamlStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"consent":{"type":"boolean","const":true}},"required":["consent"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/tokens":{"get":{"tags":["sso"],"summary":"SCIM tokens (no secrets) and the SCIM base URL","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdSsoScimTokens","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["sso"],"summary":"Create a SCIM token for a connection; the token is shown once","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdSsoScimTokens","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"connection":{"type":"string","enum":["entra","google","oidc","saml"]},"name":{"type":"string","minLength":1,"maxLength":100}},"required":["connection","name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/tokens/{tokenId}":{"delete":{"tags":["sso"],"summary":"Revoke a SCIM token","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdSsoScimTokensTokenId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"tokenId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/groups":{"get":{"tags":["sso"],"summary":"Groups pushed by the IdP with their role and org-unit mapping","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdSsoScimGroups","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/groups/{groupId}/mapping":{"put":{"tags":["sso"],"summary":"Map a group to a role and org units (applied to its members at once)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSsoScimGroupsGroupIdMapping","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"groupId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"role":{"anyOf":[{"type":"string","enum":["admin","manager","agent"]},{"type":"null"}]},"orgUnitIds":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["role"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/v2/Users":{"get":{"tags":["scim"],"summary":"SCIM (bearer token): list users (filter userName, externalId or id eq; startIndex, count)","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"getV1TenantsTenantIdSsoScimV2Users","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["scim"],"summary":"SCIM (bearer token): provision a user (address in a verified domain)","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"postV1TenantsTenantIdSsoScimV2Users","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/v2/Users/{id}":{"get":{"tags":["scim"],"summary":"SCIM (bearer token): one user","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"getV1TenantsTenantIdSsoScimV2UsersId","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["scim"],"summary":"SCIM (bearer token): replace a user","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"putV1TenantsTenantIdSsoScimV2UsersId","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["scim"],"summary":"SCIM (bearer token): PatchOp on a user (active=false deprovisions and ends sessions)","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"patchV1TenantsTenantIdSsoScimV2UsersId","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["scim"],"summary":"SCIM (bearer token): deprovision and unlink a user","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"deleteV1TenantsTenantIdSsoScimV2UsersId","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/v2/Groups":{"get":{"tags":["scim"],"summary":"SCIM (bearer token): list groups (filter displayName, externalId or id eq)","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"getV1TenantsTenantIdSsoScimV2Groups","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["scim"],"summary":"SCIM (bearer token): create a group","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"postV1TenantsTenantIdSsoScimV2Groups","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/v2/Groups/{id}":{"get":{"tags":["scim"],"summary":"SCIM (bearer token): one group","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"getV1TenantsTenantIdSsoScimV2GroupsId","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["scim"],"summary":"SCIM (bearer token): replace a group","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"putV1TenantsTenantIdSsoScimV2GroupsId","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["scim"],"summary":"SCIM (bearer token): PatchOp on a group (members add, remove, replace; displayName)","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"patchV1TenantsTenantIdSsoScimV2GroupsId","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["scim"],"summary":"SCIM (bearer token): delete a group","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"deleteV1TenantsTenantIdSsoScimV2GroupsId","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/v2/ServiceProviderConfig":{"get":{"tags":["scim"],"summary":"SCIM (bearer token): service provider configuration","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"getV1TenantsTenantIdSsoScimV2ServiceProviderConfig","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/v2/ResourceTypes":{"get":{"tags":["scim"],"summary":"SCIM (bearer token): resource types","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"getV1TenantsTenantIdSsoScimV2ResourceTypes","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/scim/v2/Schemas":{"get":{"tags":["scim"],"summary":"SCIM (bearer token): schemas","description":"SCIM 2.0: authorised by the organisation SCIM token only (no session).","operationId":"getV1TenantsTenantIdSsoScimV2Schemas","security":[{"scimToken":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/saml/metadata":{"put":{"tags":["sso"],"summary":"Connect a SAML 2.0 IdP from its uploaded metadata file (nothing is fetched)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSsoSamlMetadata","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"metadataXml":{"type":"string","minLength":50,"maxLength":200000},"defaultRole":{"default":"agent","type":"string","enum":["manager","agent"]},"autoJoin":{"default":false,"type":"boolean"}},"required":["metadataXml"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/ldap/{connectionId}/login":{"post":{"tags":["auth"],"summary":"On-prem: sign in with the directory user name and password (LDAPS or StartTLS); sets the session cookie","operationId":"postV1AuthLdapConnectionIdLogin","security":[],"parameters":[{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"username":{"type":"string","pattern":"^[^\\u0000-\\u001f\\u007f]{1,256}$"},"password":{"type":"string","minLength":1,"maxLength":1024}},"required":["username","password"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/ldap":{"put":{"tags":["sso"],"summary":"On-prem: connect Active Directory / LDAP (checked by a TLS-verified service-account bind; write-only password, required again when the server or bind DN changes; mailAuthoritative, off by default, left out keeps the stored value for the same directory)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSsoLdap","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","maxLength":300,"pattern":"^ldaps?:\\/\\/[A-Za-z0-9.\\-[\\]:]+$"},"startTls":{"default":false,"type":"boolean"},"bindDn":{"type":"string","minLength":3,"maxLength":512,"pattern":"^[^\\u0000-\\u001f]+=[^\\u0000-\\u001f]+$"},"bindPassword":{"type":"string","minLength":1,"maxLength":1024},"baseDn":{"type":"string","minLength":3,"maxLength":512,"pattern":"^[^\\u0000-\\u001f]+=[^\\u0000-\\u001f]+$"},"userFilter":{"type":"string","maxLength":1024},"emailAttribute":{"default":"mail","type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z][A-Za-z0-9-]*$"},"nameAttribute":{"default":"displayName","type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z][A-Za-z0-9-]*$"},"groupAttribute":{"default":"memberOf","type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z][A-Za-z0-9-]*$"},"nestedGroups":{"default":false,"type":"boolean"},"defaultRole":{"default":"agent","type":"string","enum":["manager","agent"]},"autoJoin":{"default":false,"type":"boolean"},"mailAuthoritative":{"type":"boolean"}},"required":["url","bindDn","baseDn"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["sso"],"summary":"On-prem: disconnect the directory (its password, links and group mappings go too)","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdSsoLdap","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/link/ldap":{"post":{"tags":["sso"],"summary":"On-prem: link your own account to the directory with your directory user name and password; owners and admins also consent to it (recent sign-in; owners and admins two-step-verified)","description":"Permission: `tenant.read`.","operationId":"postV1TenantsTenantIdSsoLinkLdap","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"consent":{"type":"boolean","const":true},"username":{"type":"string","minLength":1,"maxLength":256},"password":{"type":"string","minLength":1,"maxLength":1024}},"required":["consent","username","password"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/ldap/group-mappings":{"put":{"tags":["sso"],"summary":"On-prem: map directory groups to roles and org units (applied at sign-in)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSsoLdapGroupMappings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"group":{"type":"string","minLength":1,"maxLength":256,"pattern":"^[^\\u0000-\\u001f]+$"},"role":{"type":"string","enum":["admin","manager","agent"]},"orgUnitIds":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["group","role"],"additionalProperties":false}},"requireMappedGroup":{"default":false,"type":"boolean"},"attribute":{"type":"string","minLength":1,"maxLength":256,"pattern":"^\\S+$"}},"required":["mappings"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sso/saml/group-mappings":{"put":{"tags":["sso"],"summary":"On-prem: map SAML group claims to roles and org units (applied at sign-in)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSsoSamlGroupMappings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"mappings":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"group":{"type":"string","minLength":1,"maxLength":256,"pattern":"^[^\\u0000-\\u001f]+$"},"role":{"type":"string","enum":["admin","manager","agent"]},"orgUnitIds":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["group","role"],"additionalProperties":false}},"requireMappedGroup":{"default":false,"type":"boolean"},"attribute":{"type":"string","minLength":1,"maxLength":256,"pattern":"^\\S+$"}},"required":["mappings"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/members/{memberId}":{"patch":{"tags":["members"],"summary":"Change role, scope or suspension; an owner gives or removes an admin's billing access","description":"Permission: `members.write`.","operationId":"patchV1TenantsTenantIdMembersMemberId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"memberId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"role":{"type":"string","enum":["owner","admin","manager","agent","analyst","viewer","caller","supervisor"]},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"status":{"type":"string","enum":["active","suspended"]},"customRoleId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"billing":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["members"],"summary":"Remove a member (the account stays). 409 LAST_OWNER, 409 MEMBER_HAS_WORK","description":"Permission: `members.write`.","operationId":"deleteV1TenantsTenantIdMembersMemberId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"memberId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/api-keys":{"get":{"tags":["api-keys"],"summary":"API keys (no secrets)","description":"Permission: `api_keys.manage`.","operationId":"getV1TenantsTenantIdApiKeys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["api-keys"],"summary":"Create an API key; the key is shown once","description":"Permission: `api_keys.manage`.","operationId":"postV1TenantsTenantIdApiKeys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"scopes":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string","enum":["responses.read","surveys.read","contacts.write","events.write","voice.calls","surveys.send","tickets.read","tickets.write","reporting.read","webhooks.manage"]}},"expiresInDays":{"type":"integer","minimum":1,"maximum":730},"mode":{"type":"string","enum":["live","test"]}},"required":["name","scopes"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/api-keys/{keyId}":{"delete":{"tags":["api-keys"],"summary":"Revoke an API key","description":"Permission: `api_keys.manage`.","operationId":"deleteV1TenantsTenantIdApiKeysKeyId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"keyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/api-keys/{keyId}/rotate":{"post":{"tags":["api-keys"],"summary":"Rotate an API key: a new key with the same name and scopes, shown once; the old one stops now or after a grace period","description":"Permission: `api_keys.manage`.","operationId":"postV1TenantsTenantIdApiKeysKeyIdRotate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"keyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"graceMinutes":{"type":"integer","minimum":0,"maximum":1440}},"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/data-requests":{"get":{"tags":["privacy"],"summary":"The organisation's data export and deletion requests","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPrivacyDataRequests","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"dataRequestList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["privacy"],"summary":"Ask for a full data export, or (owner only) account deletion after 30 days","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdPrivacyDataRequests","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"kind":{"type":"string","enum":["export","deletion"]},"reason":{"type":"string","maxLength":1000},"confirmSlug":{"type":"string","maxLength":64}},"required":["kind"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/data-requests/{requestId}/cancel":{"post":{"tags":["privacy"],"summary":"Cancel a pending request (a deletion before its date)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdPrivacyDataRequestsRequestIdCancel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/data-requests/{requestId}/download":{"get":{"tags":["privacy"],"summary":"Download a ready export (signed link from the list, signed-in owner or admin)","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdPrivacyDataRequestsRequestIdDownload","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/subject-requests":{"get":{"tags":["privacy"],"summary":"Data-subject requests (a person's access or erasure), newest first, paged","description":"Permission: `privacy.manage`.","operationId":"getV1TenantsTenantIdPrivacySubjectRequests","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["requested","processing","ready","expired","completed","cancelled","failed"]}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["access","deletion"]}},{"name":"contactId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"schema":{"default":25,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["privacy"],"summary":"File an access or erasure request for a contact (by id, phone or email); rate limited","description":"Permission: `privacy.manage`.","operationId":"postV1TenantsTenantIdPrivacySubjectRequests","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"kind":{"type":"string","enum":["access","deletion"]},"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"phone":{"type":"string","pattern":"^\\+[1-9][0-9]{6,14}$"},"email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"source":{"default":"manual","type":"string","enum":["email","manual"]},"reason":{"type":"string","maxLength":1000}},"required":["kind"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/subject-requests/{requestId}":{"get":{"tags":["privacy"],"summary":"One data-subject request","description":"Permission: `privacy.manage`.","operationId":"getV1TenantsTenantIdPrivacySubjectRequestsRequestId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/subject-requests/{requestId}/verify":{"post":{"tags":["privacy"],"summary":"Confirm the person's identity (once; records who and how); processing starts only after this","description":"Permission: `privacy.manage`.","operationId":"postV1TenantsTenantIdPrivacySubjectRequestsRequestIdVerify","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"method":{"type":"string","enum":["id_document","known_channel","callback","in_person","account_login","other"]}},"required":["method"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/subject-requests/{requestId}/cancel":{"post":{"tags":["privacy"],"summary":"Cancel a pending request (an erasure only before its date)","description":"Permission: `privacy.manage`.","operationId":"postV1TenantsTenantIdPrivacySubjectRequestsRequestIdCancel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/subject-requests/{requestId}/download":{"get":{"tags":["privacy"],"summary":"Download a ready access export (signed-in owner or admin; gzipped JSON)","description":"Permission: `privacy.manage`.","operationId":"getV1TenantsTenantIdPrivacySubjectRequestsRequestIdDownload","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/legal":{"get":{"tags":["privacy"],"summary":"The published terms and DPA versions and whether an owner accepted them","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPrivacyLegal","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"legalStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/legal/acceptances":{"post":{"tags":["privacy"],"summary":"The owner accepts the published terms and DPA versions (time, user and IP are kept)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdPrivacyLegalAcceptances","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"documents":{"minItems":1,"maxItems":2,"type":"array","items":{"type":"object","properties":{"document":{"type":"string","enum":["terms","dpa"]},"version":{"type":"string","minLength":1,"maxLength":40}},"required":["document","version"],"additionalProperties":false}}},"required":["documents"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["privacy"],"summary":"The acceptance history (owners and admins)","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPrivacyLegalAcceptances","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"legalAcceptanceList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/consents/find":{"post":{"tags":["privacy"],"summary":"Find the contact whose consent history to read (by id, phone or email); rate limited","description":"Permission: `privacy.manage`.","operationId":"postV1TenantsTenantIdPrivacyConsentsFind","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"phone":{"type":"string","pattern":"^\\+[1-9][0-9]{6,14}$"},"email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/contacts/{contactId}/consents":{"get":{"tags":["privacy"],"summary":"A contact's consent history (how, when, proof) and current opt-out, newest first, paged","description":"Permission: `privacy.manage`.","operationId":"getV1TenantsTenantIdPrivacyContactsContactIdConsents","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"schema":{"default":25,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/retention":{"get":{"tags":["privacy"],"summary":"Retention rules per data class, with the allowed range and actions, each enforced class's effective state and pending change (stale, decider), oneAdmin, and approvalOn (the organisation's rules approval, flag privacy.retention_rules_approval, is on for this tenant: a new or changed responses, contacts or raw chat transcript rule will wait for a second approver)","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdPrivacyRetention","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["privacy"],"summary":"Replace the retention rules (within each class range; audited): 200 { items, oneAdmin, approvalOn }, each responses, contacts and raw chat transcript rule with its effective state. When the organisation's rules approval is on (flag privacy.retention_rules_approval, off by default), a changed responses, contacts or raw chat transcript rule waits for a second owner or admin, or for Sayvara staff when the organisation has one owner or admin (asked through Sayvara support): 202 { items, oneAdmin, approvalOn, approvals } with one approval per class; the resulting set must keep contact details at least as long as responses, else 400 RETENTION_ORDER","description":"Permission: `privacy.manage`.","operationId":"putV1TenantsTenantIdPrivacyRetention","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"rules":{"maxItems":6,"type":"array","items":{"type":"object","properties":{"dataClass":{"type":"string","enum":["conversations","responses","contacts","voice_calls","audit_refs","usage"]},"months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"action":{"type":"string","enum":["delete","anonymise"]}},"required":["dataClass","months","action"],"additionalProperties":false}}},"required":["rules"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/legal-holds":{"get":{"tags":["privacy"],"summary":"Legal holds, active first","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdPrivacyLegalHolds","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["privacy"],"summary":"Place a legal hold on a contact or an org unit, with a reason (audited)","description":"Permission: `privacy.manage`.","operationId":"postV1TenantsTenantIdPrivacyLegalHolds","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"contactId":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"},"orgUnitId":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"},"reason":{"type":"string","minLength":10,"maxLength":500}},"required":["reason"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/legal-holds/{holdId}/release":{"post":{"tags":["privacy"],"summary":"Release a legal hold, with a reason (once; audited)","description":"Permission: `privacy.manage`.","operationId":"postV1TenantsTenantIdPrivacyLegalHoldsHoldIdRelease","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"holdId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"reason":{"type":"string","minLength":10,"maxLength":500}},"required":["reason"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/dpia-template":{"get":{"tags":["privacy"],"summary":"A pre-filled data protection impact assessment template (Markdown in JSON; ?lang=en|ar). Owners and admins, tenant-wide only (403 AI_GOVERNANCE_TENANT_WIDE_ONLY); audited privacy.dpia_template.generated","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPrivacyDpiaTemplate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"dpiaTemplateQuery","response":"dpiaTemplate"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/privacy/records-of-processing":{"get":{"tags":["privacy"],"summary":"Records of processing, one per family of privacy data classes, together covering every registered class and listing each: purpose, categories of data and subjects, legal basis, retention (your rules), processors and sub-processors, cross-border transfers (?lang=en|ar&format=json|csv; JSON envelope, CSV as text in it). Owners and admins, tenant-wide only (403 AI_GOVERNANCE_TENANT_WIDE_ONLY); audited privacy.records_of_processing.generated","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPrivacyRecordsOfProcessing","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"recordsOfProcessingQuery","response":"recordsOfProcessing"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels":{"get":{"tags":["setup"],"summary":"Channels: connected, available or roadmap, with 30-day usage","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdChannels","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"channelList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/policy":{"get":{"tags":["setup"],"summary":"Messaging policy (defaults when never saved)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPolicy","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"tenantPolicy"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["setup"],"summary":"Change the messaging policy","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdPolicy","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"tenantPolicyPatch","response":"tenantPolicy"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts tenantPolicyPatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/email-domains":{"get":{"tags":["setup"],"summary":"Email sending domains with their DNS records, check results and readiness","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdChannelsEmailDomains","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"emailDomainList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Add an email sending domain; returns the DKIM, SPF and DMARC records to publish","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsEmailDomains","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"emailDomainCreateBody","response":"emailDomain"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts emailDomainCreateBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/email-domains/{domainId}/check":{"post":{"tags":["setup"],"summary":"Look the DNS records up now","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsEmailDomainsDomainIdCheck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"domainId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"emptyBody","response":"emailDomain"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts emptyBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/email-domains/{domainId}/test-send":{"post":{"tags":["setup"],"summary":"Send a test email from the domain (409 EMAIL_SENDING_NOT_ENABLED until email goes live)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsEmailDomainsDomainIdTestSend","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"domainId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"emailDomainTestSendBody"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts emailDomainTestSendBody"}}}},"responses":{"409":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/email-domains/{domainId}":{"delete":{"tags":["setup"],"summary":"Remove an email sending domain","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdChannelsEmailDomainsDomainId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"domainId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/whatsapp/own-number":{"get":{"tags":["setup"],"summary":"The own WhatsApp number with status, quality, tier and template states; availability and routing","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdChannelsWhatsappOwnNumber","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ownNumberState"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"Disconnect the own number (Sayvara unsubscribes; the tenant keeps its number)","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdChannelsWhatsappOwnNumber","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/whatsapp/own-number/start":{"post":{"tags":["setup"],"summary":"Start Embedded Signup: a one-time state and the Meta app and configuration ids (503 until configured)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsWhatsappOwnNumberStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ownNumberStartBody","response":"ownNumberStart"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ownNumberStartBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/whatsapp/own-number/complete":{"post":{"tags":["setup"],"summary":"Finish Embedded Signup: code exchange, number registration and webhook subscription","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsWhatsappOwnNumberComplete","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ownNumberCompleteBody","response":"ownNumberSender"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ownNumberCompleteBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/whatsapp/own-number/sync":{"post":{"tags":["setup"],"summary":"Read the number and its templates from Meta now","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsWhatsappOwnNumberSync","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"emptyBody","response":"ownNumberSender"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts emptyBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/whatsapp/own-number/templates":{"get":{"tags":["setup"],"summary":"Sayvara's required templates on the own number: Meta's state on the WABA, and whether Sayvara may submit them","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdChannelsWhatsappOwnNumberTemplates","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ownNumberTemplateSubmission"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/whatsapp/own-number/templates/submit":{"post":{"tags":["setup"],"summary":"Submit the required templates Meta does not hold on the tenant's WABA yet (404 TEMPLATE_SUBMIT_OFF while switched off; 202 pending_approval when the organisation needs approval for template submission)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsWhatsappOwnNumberTemplatesSubmit","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"emptyBody","response":"ownNumberTemplateSubmit"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts emptyBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/whatsapp/own-number/fallback":{"put":{"tags":["setup"],"summary":"Allow or refuse the shared Sayvara sender while the own number is not online","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdChannelsWhatsappOwnNumberFallback","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ownNumberFallbackBody","response":"ownNumberState"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ownNumberFallbackBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/white-label/hostnames":{"get":{"tags":["setup"],"summary":"Custom survey domains with their DNS records, TLS and edge state","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWhiteLabelHostnames","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"customHostnameList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Add a custom survey domain (plan entitlement custom_domains); returns the TXT and CNAME records to publish","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdWhiteLabelHostnames","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"customHostnameCreateBody","response":"customHostname"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts customHostnameCreateBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/white-label/hostnames/{hostnameId}/check":{"post":{"tags":["setup"],"summary":"Look the DNS records up now and ask the edge for the certificate","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdWhiteLabelHostnamesHostnameIdCheck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"hostnameId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"emptyBody","response":"customHostname"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts emptyBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/white-label/hostnames/{hostnameId}":{"delete":{"tags":["setup"],"summary":"Remove a custom survey domain (stops routing first)","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdWhiteLabelHostnamesHostnameId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"hostnameId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/white-label/branding":{"get":{"tags":["setup"],"summary":"Sender display name and the remove-branding switch, with what applies now","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWhiteLabelBranding","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"tenantBranding"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"Change the sender display name and the remove-branding switch (hiding needs remove_branding)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdWhiteLabelBranding","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"tenantBrandingBody","response":"tenantBranding"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts tenantBrandingBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/entitlements":{"get":{"tags":["seams"],"summary":"What the plan includes: one decision per entitlement key","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdEntitlements","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"entitlementList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/flags":{"get":{"tags":["seams"],"summary":"Feature flag states for this organisation","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdFlags","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"flagList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/catalogue":{"get":{"tags":["seams"],"summary":"Integrations, channels and add-ons: available, early access or roadmap","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatalogue","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catalogueList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/plan":{"get":{"tags":["billing"],"summary":"The plan of the organisation, its status and period, and every limit with its use (no prices)","description":"Permission: `billing.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingPlan","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"tenantPlan"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/usage":{"get":{"tags":["billing"],"summary":"Usage for ?from..to (Riyadh days, at most 366; default the allowance period): every plan limit exactly as Settings > Plan reports it (use, allowance, 80 / 100 % level), totals per channel and destination country, a daily series, 12 months of history, the overage so far this period priced from the usage ledger (billing currency, VAT apart; unpriced units reported) and a pace projection to the period end, labelled as an estimate","description":"Permission: `billing.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingUsage","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"usageQuery","response":"tenantUsage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/usage.csv":{"get":{"tags":["billing"],"summary":"The same filter as CSV rows per day, channel and country (UTF-8 with BOM; ids, enums and numbers only)","description":"Permission: `billing.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingUsageCsv","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"usageQuery"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/overage-rates":{"get":{"tags":["billing"],"summary":"The organisation's overage price per channel, destination country and category from the published sell rates, live and upcoming (billing currency, excluding VAT)","description":"Permission: `billing.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingOverageRates","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"overageRates"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/addons/preview":{"get":{"tags":["billing"],"summary":"Cost of an add-on or more seats now: the share of the current period, VAT on top","description":"Permission: `billing.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingAddonsPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"addonPurchaseBody","response":"addonPurchasePreview"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/addons":{"post":{"tags":["billing"],"summary":"Buy an add-on or more seats now: held at once, an invoice for the rest of the period and the hosted Moyasar form (billing switched on only). Needs an Idempotency-Key header (8-128 visible ASCII; 400 IDEMPOTENCY_KEY_REQUIRED / BAD_IDEMPOTENCY_KEY): a repeat answers the first result and buys nothing more (its payment only while the invoice is unpaid); the same key with another code or quantity answers 422 IDEMPOTENCY_KEY_REUSED. While an earlier purchase of the same add-on is unpaid: 409 ADDON_PURCHASE_BLOCKED, reason payment_pending","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingAddons","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"addonPurchaseBody","response":"addonPurchaseResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts addonPurchaseBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/banner":{"get":{"tags":["billing"],"summary":"Banner state for every member: suspended, past due, trial end and limits at 80 or 100 % (no numbers)","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingBanner","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"billingBanner"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sandbox":{"get":{"tags":["setup"],"summary":"TR-25: whether this is a sandbox, or the organisation's sandbox if it has one","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSandbox","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sandboxState"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"TR-25: open the organisation's one sandbox (separate tenant, test data, never sends; needs a plan)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSandbox","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sandboxView"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/edge/intake":{"post":{"tags":["seams"],"summary":"Edge intake queue consumer: signed batch of survey envelopes (Sayvara-Signature), one outcome per envelope","operationId":"postV1EdgeIntake","security":[{"signature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/catalogue/integrations":{"get":{"tags":["catalogue"],"summary":"Public integration catalogue (PL-14): the public label (early access or roadmap) per item; cacheable, any origin","operationId":"getV1CatalogueIntegrations","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/catalogue/pricing":{"get":{"tags":["catalogue"],"summary":"Public pricing from the console catalogue: self-serve plans with prices (net, VAT, total) for a country, contact-only cards, add-ons, trial; empty until the console switch is on; cacheable, any origin","operationId":"getV1CataloguePricing","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/files/{token}":{"get":{"tags":["seams"],"summary":"Download a file by a signed, expiring link (local or S3-compatible file store)","operationId":"getV1FilesToken","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/support-access":{"get":{"tags":["support-access"],"summary":"Support access requests and grants from Five Rivers staff (PL-07)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSupportAccess","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"supportGrantList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/support-access/banner":{"get":{"tags":["support-access"],"summary":"Banner state: the live support grant, open requests for the owner","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSupportAccessBanner","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"supportBanner"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/support-access/{grantId}/approve":{"post":{"tags":["support-access"],"summary":"Owner approves a support request (access starts now, ends after its duration)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSupportAccessGrantIdApprove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"grantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"supportDecisionBody","response":"supportGrant"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts supportDecisionBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/support-access/{grantId}/deny":{"post":{"tags":["support-access"],"summary":"Owner denies a support request","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSupportAccessGrantIdDeny","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"grantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"supportDecisionBody","response":"supportGrant"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts supportDecisionBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/support-access/{grantId}/end":{"post":{"tags":["support-access"],"summary":"End a live support grant now (owner or admin)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSupportAccessGrantIdEnd","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"grantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"supportDecisionBody","response":"supportGrant"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts supportDecisionBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/announcements":{"get":{"tags":["announcements"],"summary":"Live in-app announcements for this member (EN + AR), already filtered by audience and schedule (PL-08)","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAnnouncements","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"tenantAnnouncementList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/announcements/{announcementId}/dismiss":{"post":{"tags":["announcements"],"summary":"Dismiss an announcement for this member only","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdAnnouncementsAnnouncementIdDismiss","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"announcementId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"announcementDismissBody"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts announcementDismissBody"}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/holiday-templates":{"get":{"tags":["tickets"],"summary":"CL-05 calendar templates (SA, AE, KW): working week, time zone and the public holidays of this year and next (or ?year=), proposed until platform staff confirm the year, then confirmed","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdHolidayTemplates","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"holidayTemplatesQuery","response":"tenantHolidayTemplates"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/inbound":{"post":{"tags":["messaging"],"summary":"Twilio inbound WhatsApp / SMS (form-encoded, X-Twilio-Signature); answers empty TwiML","operationId":"postV1MessagingTwilioInbound","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/status":{"post":{"tags":["messaging"],"summary":"Twilio delivery status callback (form-encoded, X-Twilio-Signature)","operationId":"postV1MessagingTwilioStatus","security":[{"twilioSignature":[]}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/meta/webhook":{"get":{"tags":["messaging"],"summary":"Meta webhook subscription check (hub.verify_token); answers hub.challenge","operationId":"getV1MessagingMetaWebhook","security":[{"signature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["messaging"],"summary":"Meta WhatsApp webhooks for own numbers (X-Hub-Signature-256): messages, statuses, account and template changes","operationId":"postV1MessagingMetaWebhook","security":[{"signature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/sms-gateway":{"get":{"tags":["messaging"],"summary":"The own SMS gateway of the organisation (never its credential or report secret)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdChannelsSmsGateway","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"smsGatewayState"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["messaging"],"summary":"Create or change the own SMS gateway; the credential goes to the Secrets seam; a new report secret is shown once","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdChannelsSmsGateway","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"smsGatewayBody","response":"smsGatewayView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"status":{"type":"string","enum":["draft","active","paused"]},"numbers":{"default":"saudi","type":"string","enum":["saudi","all"]},"exclusive":{"default":false,"type":"boolean"},"senderId":{"type":"string","pattern":"^([A-Za-z0-9 .&-]{3,11}|\\+[1-9][0-9]{6,14})$"},"settings":{"anyOf":[{"type":"object","properties":{"urlTemplate":{"type":"string","minLength":10,"maxLength":1000},"method":{"type":"string","enum":["POST","GET"]},"bodyFormat":{"type":"string","enum":["json","form","none"]},"bodyTemplate":{"type":"object","propertyNames":{"type":"string","maxLength":64},"additionalProperties":{}},"headers":{"type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z0-9-]{1,64}$"},"additionalProperties":{"type":"string","maxLength":200}},"auth":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"none"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"header"},"header":{"type":"string","pattern":"^[A-Za-z0-9-]{1,64}$"},"prefix":{"type":"string","maxLength":20}},"required":["kind","header"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"basic"},"username":{"type":"string","minLength":1,"maxLength":100}},"required":["kind","username"],"additionalProperties":false}]},"success":{"type":"object","properties":{"statusFrom":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"statusTo":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"path":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,64}$"},"equals":{"type":"string","maxLength":100},"contains":{"type":"string","maxLength":100},"messageIdPath":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,64}$"}},"additionalProperties":false},"receipt":{"type":"object","properties":{"auth":{"type":"string","enum":["hmac_sha256","shared_secret"]},"header":{"type":"string","pattern":"^[A-Za-z0-9-]{1,64}$"},"queryToken":{"type":"boolean"},"idField":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,64}$"},"statusField":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,64}$"},"errorField":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,64}$"},"statusMap":{"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"type":"string","enum":["queued","sent","delivered","read","undelivered","failed"]}}},"required":["auth","idField","statusField"],"additionalProperties":false}},"required":["urlTemplate","method","bodyFormat","auth","success","receipt"],"additionalProperties":false},{"type":"object","properties":{"provider":{"type":"string","const":"msegat"},"userName":{"type":"string","pattern":"^[A-Za-z0-9_.@-]{1,64}$"}},"required":["provider","userName"],"additionalProperties":false},{"type":"object","properties":{"provider":{"type":"string","const":"unifonic"}},"required":["provider"],"additionalProperties":false},{"type":"object","properties":{"provider":{"type":"string","const":"taqnyat"}},"required":["provider"],"additionalProperties":false},{"type":"object","properties":{"provider":{"type":"string","const":"twilio"},"accountSid":{"type":"string","pattern":"^AC[0-9a-f]{32}$"}},"required":["provider","accountSid"],"additionalProperties":false}]},"credential":{"type":"string","minLength":1,"maxLength":2000},"rotateReceiptSecret":{"type":"boolean"}},"required":["name","status","senderId","settings"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["messaging"],"summary":"Remove the own SMS gateway and its secrets","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdChannelsSmsGateway","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/sms-gateway/check":{"post":{"tags":["messaging"],"summary":"Check an own Msegat, Unifonic, Taqnyat or Twilio connection with its saved key (account balance; sends nothing)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsSmsGatewayCheck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"smsGatewayCheck"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/sms-gateway/test":{"post":{"tags":["messaging"],"summary":"Queue one test SMS through the own connection only (optional Idempotency-Key header, up to 64 characters: a repeat queues nothing new and is not counted; without it, the same number within the same minute counts as a repeat)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsSmsGatewayTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"smsGatewayTestBody","response":"smsGatewayTestQueued"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"to":{"type":"string","pattern":"^\\+[1-9][0-9]{6,14}$"},"lang":{"default":"ar","type":"string","enum":["ar","en"]}},"required":["to"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/sms-gateway/{tenantId}/{gatewayId}/status":{"post":{"tags":["messaging"],"summary":"Delivery report from an own SMS gateway (HMAC-SHA256 of the body, or the shared secret)","operationId":"postV1MessagingSmsGatewayTenantIdGatewayIdStatus","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"gatewayId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/sms/{provider}/status":{"post":{"tags":["messaging"],"summary":"Delivery receipt from a Saudi SMS route (unifonic or taqnyat; the route token in ?token=)","operationId":"postV1MessagingSmsProviderStatus","security":[],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/meta/dm":{"get":{"tags":["messaging"],"summary":"Meta webhook subscription check (hub.verify_token); answers hub.challenge as text","operationId":"getV1MessagingMetaDm","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["messaging"],"summary":"Instagram DM and Messenger webhook (X-Hub-Signature-256 over the raw JSON); queues msg.dm_inbound","operationId":"postV1MessagingMetaDm","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/social/meta":{"get":{"tags":["messaging"],"summary":"Connected Instagram accounts and Facebook Pages (no tokens), and whether the connect flow is switched on","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdChannelsSocialMeta","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/social/meta/pages":{"post":{"tags":["messaging"],"summary":"Exchange the Facebook Login for Business code; lists the Pages the person manages and a sealed 15-minute login session","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdChannelsSocialMetaPages","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","minLength":8,"maxLength":2048}},"required":["code"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/social/meta/connect":{"post":{"tags":["messaging"],"summary":"Connect Messenger and / or the linked Instagram account of one Page (Meta ownership proof, webhook subscription, Page token to the vault); also reconnects a broken one","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdChannelsSocialMetaConnect","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"session":{"type":"string","pattern":"^[A-Za-z0-9_-]{40,8192}$"},"pageId":{"type":"string","pattern":"^[0-9]{1,32}$"},"channels":{"minItems":1,"maxItems":2,"type":"array","items":{"type":"string","enum":["messenger","instagram"]}}},"required":["session","pageId","channels"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/social/meta/{connectionId}":{"delete":{"tags":["messaging"],"summary":"Disconnect (the Page token leaves the vault; Sayvara unsubscribes from the Page when nothing else uses it)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdChannelsSocialMetaConnectionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/telegram":{"get":{"tags":["messaging"],"summary":"Connected Telegram bots (no tokens), and whether Telegram is switched on for the organisation (preview)","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdChannelsTelegram","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/telegram/connect":{"post":{"tags":["messaging"],"summary":"Connect or reconnect the organisation's own Telegram bot by its BotFather token (getMe ownership proof, webhook set, token to the vault)","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdChannelsTelegramConnect","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","pattern":"^[1-9][0-9]{0,15}:[A-Za-z0-9_-]{30,64}$"}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/telegram/{connectionId}":{"delete":{"tags":["messaging"],"summary":"Disconnect a Telegram bot (webhook removed, token leaves the vault)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdChannelsTelegramConnectionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/telegram/{connectionId}/start-link":{"post":{"tags":["messaging"],"summary":"A signed t.me deep link (30 days) that links the Telegram chat that opens it to a contact","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdChannelsTelegramConnectionIdStartLink","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["contactId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/telegram/{botId}":{"post":{"tags":["messaging"],"summary":"Telegram bot webhook (X-Telegram-Bot-Api-Secret-Token checked); STOP and /start links handled","operationId":"postV1MessagingTelegramBotId","security":[],"parameters":[{"name":"botId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/rcs/webhook":{"post":{"tags":["messaging"],"summary":"RCS (Google RBM) webhook, coming soon: set-up check, user messages and receipts (X-Goog-Signature); queues msg.rich_inbound","operationId":"postV1MessagingRcsWebhook","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/apple/message":{"post":{"tags":["messaging"],"summary":"Apple Messages for Business MSP webhook, coming soon (HS256 bearer token); queues msg.rich_inbound","operationId":"postV1MessagingAppleMessage","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/apple-messages/start-link":{"post":{"tags":["messaging"],"summary":"Apple Messages for Business start link, coming soon: a signed link (14 days) that links the customer who writes through it to a contact","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdChannelsAppleMessagesStartLink","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"businessId":{"type":"string","minLength":1,"maxLength":200}},"required":["contactId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/slack/interactivity":{"post":{"tags":["messaging"],"summary":"Slack alert-card button click (form-encoded payload, X-Slack-Signature, 5-minute window)","operationId":"postV1MessagingSlackInteractivity","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/alert-actions/{token}":{"get":{"tags":["messaging"],"summary":"Teams alert-card button: confirm page (HTML, EN/AR); never acts","operationId":"getV1MessagingAlertActionsToken","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["messaging"],"summary":"Teams alert-card button: confirmed action (signed token); outbox event alert.action_requested","operationId":"postV1MessagingAlertActionsToken","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/rg/{region}/hooks/{source}/{connectionId}":{"post":{"tags":["messaging"],"summary":"Provider webhook through the edge gateway: twilio (inbound, TwiML) or meta, same checks and jobs as the direct URLs (404 unless EDGE_HOOKS_ENABLED and {region} is this API's region; connectionId `shared` for twilio, meta, unifonic and taqnyat; sms-gateway/{tenant hex}{gateway hex}/status for an own SMS connection (tenant flag messaging.connection_regions, 421 CONNECTION_WRONG_REGION outside its region))","operationId":"postV1RgRegionHooksSourceConnectionId","security":[],"parameters":[{"name":"region","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["messaging"],"summary":"Meta webhook subscription check on the region path (404 unless EDGE_HOOKS_ENABLED and {region} is this API's region; connectionId `shared` for twilio, meta, unifonic and taqnyat; sms-gateway/{tenant hex}{gateway hex}/status for an own SMS connection (tenant flag messaging.connection_regions, 421 CONNECTION_WRONG_REGION outside its region))","operationId":"getV1RgRegionHooksSourceConnectionId","security":[],"parameters":[{"name":"region","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/rg/{region}/hooks/{source}/{connectionId}/status":{"post":{"tags":["messaging"],"summary":"Delivery status through the edge gateway: twilio, meta, unifonic, taqnyat or an own SMS connection (sms-gateway) (404 unless EDGE_HOOKS_ENABLED and {region} is this API's region; connectionId `shared` for twilio, meta, unifonic and taqnyat; sms-gateway/{tenant hex}{gateway hex}/status for an own SMS connection (tenant flag messaging.connection_regions, 421 CONNECTION_WRONG_REGION outside its region))","operationId":"postV1RgRegionHooksSourceConnectionIdStatus","security":[],"parameters":[{"name":"region","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/edge/hooks":{"post":{"tags":["seams"],"summary":"Edge webhook buffer drain: signed batch (Sayvara-Signature) of sealed provider webhooks, one outcome per item (stored, wrong_region, invalid, retry); 404 unless EDGE_HOOKS_ENABLED","operationId":"postV1EdgeHooks","security":[{"signature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/teams/messages":{"post":{"tags":["messaging"],"summary":"Teams bot messaging endpoint (Bot Framework activity, bearer token of the Bot Connector service for our app id): card buttons answer a refreshed card; `link <code>` links the channel","operationId":"postV1MessagingTeamsMessages","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/teams-app":{"get":{"tags":["messaging"],"summary":"Whether the Teams bot is set up on this deployment, and the linked Teams channels (404 while channels.teams_app is off)","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdChannelsTeamsApp","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/teams-app/link-codes":{"post":{"tags":["messaging"],"summary":"One-time 15-minute link code to type to the bot in a Teams channel (`link <code>`); shown once","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdChannelsTeamsAppLinkCodes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{},"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/teams-app/links/{linkId}":{"delete":{"tags":["messaging"],"summary":"Unlink a Teams channel (its cards stop; buttons on cards already posted are refused)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdChannelsTeamsAppLinksLinkId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"linkId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice/incoming":{"post":{"tags":["messaging"],"summary":"Twilio voice webhook: incoming (form-encoded, X-Twilio-Signature, Sayvara's AccountSid only); answers TwiML","operationId":"postV1MessagingTwilioVoiceIncoming","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice/code":{"post":{"tags":["messaging"],"summary":"Twilio voice webhook: code (form-encoded, X-Twilio-Signature, Sayvara's AccountSid only); answers TwiML","operationId":"postV1MessagingTwilioVoiceCode","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice/answer":{"post":{"tags":["messaging"],"summary":"Twilio voice webhook: answer (form-encoded, X-Twilio-Signature, Sayvara's AccountSid only); answers TwiML","operationId":"postV1MessagingTwilioVoiceAnswer","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice/gather":{"post":{"tags":["messaging"],"summary":"Twilio voice webhook: gather (form-encoded, X-Twilio-Signature, Sayvara's AccountSid only); answers TwiML","operationId":"postV1MessagingTwilioVoiceGather","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice/status":{"post":{"tags":["messaging"],"summary":"Twilio voice call status callback: meters billed minutes and closes the call once","operationId":"postV1MessagingTwilioVoiceStatus","security":[{"twilioSignature":[]}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice-bridge/status":{"post":{"tags":["messaging"],"summary":"Twilio status callback of a phone-interview call: moves its state, meters billed minutes once","operationId":"postV1MessagingTwilioVoiceBridgeStatus","security":[{"twilioSignature":[]}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice-bridge/screen":{"post":{"tags":["messaging"],"summary":"Twilio (legacy, customer-first calls in flight at deploy): the press-1 screen a phone-number caller hears on answer (TwiML)","operationId":"postV1MessagingTwilioVoiceBridgeScreen","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice-bridge/screen/accept":{"post":{"tags":["messaging"],"summary":"Twilio: the screen answer; 1 connects the respondent, anything else hangs up the caller leg (TwiML)","operationId":"postV1MessagingTwilioVoiceBridgeScreenAccept","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice-bridge/agent/accept":{"post":{"tags":["messaging"],"summary":"Twilio: the phone-mode caller pressed a key on the screen; 1 re-checks and dials the respondent, else hangs up (TwiML)","operationId":"postV1MessagingTwilioVoiceBridgeAgentAccept","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice-bridge/agent/leg":{"post":{"tags":["messaging"],"summary":"Twilio: the respondent's leg of a phone-mode call answered or ended","operationId":"postV1MessagingTwilioVoiceBridgeAgentLeg","security":[{"twilioSignature":[]}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice-bridge/agent/after":{"post":{"tags":["messaging"],"summary":"Twilio: the caller's Dial of the respondent ended; ends the call once, one short line to the caller (TwiML)","operationId":"postV1MessagingTwilioVoiceBridgeAgentAfter","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice-bridge/screen/after":{"post":{"tags":["messaging"],"summary":"Twilio: after the caller leg ended; hangs up a bridged call, or tells the respondent the interviewer was not available (TwiML)","operationId":"postV1MessagingTwilioVoiceBridgeScreenAfter","security":[{"twilioSignature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/twilio/voice-bridge/recording":{"post":{"tags":["messaging"],"summary":"Twilio recording callback: stores a consented recording in the tenant region","operationId":"postV1MessagingTwilioVoiceBridgeRecording","security":[{"twilioSignature":[]}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/email/{provider}/{tenantId}/{senderId}/events":{"post":{"tags":["messaging"],"summary":"SendGrid / Amazon SES delivery events for a tenant email gateway (SendGrid ECDSA signature; SES: route token, then the SNS message signature, timestamp and the sender topic; a verified SNS subscription is confirmed); queues status.handle","operationId":"postV1MessagingEmailProviderTenantIdSenderIdEvents","security":[],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"senderId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/messaging/voice/calls":{"post":{"tags":["messaging"],"summary":"Call-centre hand-off for a phone survey: transfer to the IVR or a callback after the call (API key bearer, scope events.write; once the organisation turns on signed triggers (CH-08), a Sayvara-Signature of the raw body made in the last 5 minutes, else 401 INVALID_SIGNATURE; shown as auth none until the API key scheme of #88 is in this map; 503 VOICE_NOT_LIVE until switched on)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1MessagingVoiceCalls","security":[],"x-sayvara-contract":{"body":"voiceTriggerRequestSchema","response":"voiceTriggerResponseSchema"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts voiceTriggerRequestSchema"}}}},"responses":{"202":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/policy/sending":{"get":{"tags":["setup"],"summary":"Sending policy: fallback order, quiet hours, survey hours, prayer times, reminders (defaults when never saved) and today's Riyadh prayer windows","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPolicySending","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sendingPolicy"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"Replace the sending policy (organisation-wide members only, else 403 ORG_WIDE_ONLY); audited","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdPolicySending","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"sendingPolicyPut","response":"sendingPolicy"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sendingPolicyPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/triggers":{"post":{"tags":["public-api"],"summary":"Ask for a survey invitation after an event (API key bearer, scope surveys.send (keys issued with events.write keep working), plan api_access; optional Idempotency-Key header: a repeat answers replayed true and queues nothing new; the same key with another body answers 422 IDEMPOTENCY_KEY_REUSED; once the organisation turns on signed triggers, a Sayvara-Signature t=,v1= HMAC-SHA256 of the raw body made in the last 5 minutes, else 401 INVALID_SIGNATURE, and an Idempotency-Key, else 400 IDEMPOTENCY_KEY_REQUIRED; the same signed request with another key answers 409 SIGNED_REQUEST_REPLAYED). Consent, opt-out, frequency, send hours and plan limits still apply. A test key (svk_test_) gets the same checks and status test: no contact, invitation, real message or billing is created (the key use is still logged, marked test); where the organisation has test sends on, the planned invite goes to the fake provider only (delivery fake) and survey.sent with test true goes to endpoints that opted in to test events","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1Triggers","security":[],"x-sayvara-contract":{"body":"triggerRequest","response":"triggerAccepted"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts triggerRequest"}}}},"responses":{"202":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/triggers/pbx/{vendor}":{"post":{"tags":["public-api"],"summary":"A phone system's end-of-call event as the vendor sends it (vendor 3cx, yeastar, asterisk, avaya, webex-cc or amazon-connect), mapped to one POST /v1/triggers call with event call.ended and kind call; the same API key, scope events.write, plan api_access and Sayvara-Signature over the raw body when signed triggers are on; the Idempotency-Key is derived from the vendor's call id. Query: surveyId, orgUnitId, lang, country (default SA, for national numbers), utcOffset (PBX local time; default the country's), minTalkSeconds, direction (inbound, outbound or both), pbx (which of several systems of one vendor sent it; part of the idempotency key). Calls that get no survey answer 202 { status: ignored, reason } (another leg of an already surveyed call: reason already_surveyed); a signed request answered ignored and sent again with other query options (outside the signature) answers 409 SIGNED_REQUEST_REPLAYED","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TriggersPbxVendor","security":[],"parameters":[{"name":"vendor","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"pbxTriggerQuery","response":"pbxTriggerAnswer"},"responses":{"202":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/data/responses":{"get":{"tags":["public-api"],"summary":"Completed responses of the key's organisation, oldest first, cursor paging (API key bearer, scope responses.read, plan api_access)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1DataResponses","security":[],"x-sayvara-contract":{"query":"publicResponsesQuery","response":"publicResponsePage"},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/trigger-signing":{"get":{"tags":["setup"],"summary":"Whether trigger calls must be signed, and the secrets that verify now (no values)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTriggerSigning","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"triggerSigningStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"Turn signed triggers off: every secret retires now and the API key alone is enough","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdTriggerSigning","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/trigger-signing/rotate":{"post":{"tags":["setup"],"summary":"Turn signed triggers on or rotate the secret (shown once; earlier secrets verify for 24 h more; at most 8 active, the oldest beyond that retire at once)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTriggerSigningRotate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"triggerSigningSecret"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/webhook-endpoints/{webhookId}/rotate-secret":{"post":{"tags":["setup"],"summary":"New signing secret, shown once; the old one keeps signing (second v1=) for 24 h","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdWebhookEndpointsWebhookIdRotateSecret","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"webhookSecretRotated"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/webhook-endpoints/{webhookId}/deliveries":{"get":{"tags":["setup"],"summary":"Delivery log of an outbound webhook endpoint (newest first, cursor) and its health","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWebhookEndpointsWebhookIdDeliveries","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"webhookDeliveryPage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/webhook-endpoints/{webhookId}/enable":{"post":{"tags":["setup"],"summary":"Turn an endpoint switched off after 50 dead-lettered deliveries back on","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdWebhookEndpointsWebhookIdEnable","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/webhook-endpoints/{webhookId}/options":{"get":{"tags":["setup"],"summary":"The events the endpoint receives , whether events about a contact carry data.contact (id, phone, email) and whether test-mode events (test: true) are received; both off by default","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWebhookEndpointsWebhookIdOptions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"webhookEndpointOptions"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"Pick the events, turn include_contact on or off (on also needs privacy.manage: owners and admins; contact details are read when each try is made, never stored in the delivery log) and opt in or out of test-mode events (testEvents)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdWebhookEndpointsWebhookIdOptions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"webhookEndpointOptionsUpdate","response":"webhookEndpointOptions"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts webhookEndpointOptionsUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/webhook-endpoints/{webhookId}/deliveries/{deliveryId}/replay":{"post":{"tags":["setup"],"summary":"Send a delivered, dead-lettered or stuck (overdue 15 min, not running) delivery again (same event id)","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdWebhookEndpointsWebhookIdDeliveriesDeliveryIdReplay","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"deliveryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sdk-apps":{"get":{"tags":["sdk"],"summary":"In-app SDK apps of the organisation: public app key, survey, identity mode, event rules, display, web origins, status, daily link cap and today's count (never the identity secret)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSdkApps","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sdkAppList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["sdk"],"summary":"Add an in-app SDK app for one survey: a new public app key and an identity secret for signing user tokens (in this response only)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSdkApps","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"sdkAppCreateBody","response":"sdkAppWithSecret"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sdkAppCreateBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sdk-apps/{appId}":{"patch":{"tags":["sdk"],"summary":"Change an in-app SDK app (survey, identity mode, rules, display, origins, daily link cap) or pause and resume it","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdSdkAppsAppId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"appId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"sdkAppUpdateBody","response":"sdkApp"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sdkAppUpdateBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["sdk"],"summary":"Remove an in-app SDK app (the SDK in the app goes silent)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdSdkAppsAppId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"appId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sdk-apps/{appId}/rotate-secret":{"post":{"tags":["sdk"],"summary":"A new identity secret (in this response only); the previous one keeps verifying user tokens for 24 hours","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSdkAppsAppIdRotateSecret","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"appId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sdkAppWithSecret"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sdk/{key}/config":{"get":{"tags":["sdk"],"summary":"The SDK's rules, display and identity mode; native apps send no Origin, a web app's Origin must be listed (CORS, Vary: Origin); 404 for an unknown or paused key or another origin","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1SdkKeyConfig","security":[],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sdkConfig"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sdk/{key}/link":{"post":{"tags":["sdk"],"summary":"A fresh 30-minute signed survey link (channel in_app) for a verified user token (JWT HS256 signed with the app's identity secret); the server always checks a verified user's sample and frequency cap (force: true allows one extra link per user and window; the old body field enforce is accepted and ignored); 401 SDK_IDENTITY_REQUIRED or SDK_IDENTITY_INVALID, 403 SDK_NOT_SAMPLED, 410 survey closed, 429 rate limit (Retry-After), SDK_FREQUENCY_CAP or SDK_DAILY_CAP, 503 not set up","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SdkKeyLink","security":[],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"sdkLinkBody","response":"sdkLink"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sdkLinkBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai-governance":{"get":{"tags":["ai-governance"],"summary":"TR-09 inventory of AI uses (`enforced` false: switches and approval recorded, not yet applied): each feature with its route, model provider, processing country, data sent (masked), switch and why it is off; the approval and the residency rule","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAiGovernance","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"aiGovernanceOverview"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai-governance/features/{feature}":{"put":{"tags":["ai-governance"],"summary":"Switch one built AI feature on or off (audited ai.governance.feature_set; 409 for a feature not in the inventory or planned). Recorded now; applied once the AI gateway calls seam 2.25 (overview `enforced`)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdAiGovernanceFeaturesFeature","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"feature","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"aiFeatureSwitchBody","response":"aiGovernanceOverview"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts aiFeatureSwitchBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai-governance/approval":{"put":{"tags":["ai-governance"],"summary":"Record or withdraw the data officer's AI approval (owner only, 403 OWNER_REQUIRED; a government organisation cannot drop the requirement, 409)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdAiGovernanceApproval","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"aiApprovalBody","response":"aiGovernanceOverview"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts aiApprovalBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai-governance/usage":{"get":{"tags":["ai-governance"],"summary":"Metered AI calls and tokens per UTC day, feature, provider and model; run outcomes, processing countries and masking counts by type (?days=1..366, default 30)","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAiGovernanceUsage","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"aiGovernanceUsage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai-governance/runs":{"get":{"tags":["ai-governance"],"summary":"The AI run log, newest first, cursor paging (?limit, cursor, feature, outcome); no prompt or output text","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAiGovernanceRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"aiRunPage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai-governance/events":{"get":{"tags":["ai-governance"],"summary":"AI audit events (settings, keys, residency, governance, exports), newest first, cursor paging","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAiGovernanceEvents","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"aiAuditPage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai-governance/export":{"get":{"tags":["ai-governance"],"summary":"Compliance export for audits (audited): inventory, policy, usage, runs and AI audit events for ?from..to (inclusive UTC days, at most 366; default 30 days); format=csv gives the runs. At most 10 000 rows (`truncated` per kind); one export per organisation at a time (429 AI_EXPORT_BUSY)","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAiGovernanceExport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"aiGovernanceExport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tawakkalna/settings":{"get":{"tags":["tawakkalna"],"summary":"Tawakkalna-ready (integration on the roadmap) settings: on or off, key version, and whether the platform and Nafath are available","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdTawakkalnaSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["tawakkalna"],"summary":"Turn the organisation's signed Tawakkalna-ready entry links on or off","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdTawakkalnaSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tawakkalna/settings/rotate":{"post":{"tags":["tawakkalna"],"summary":"Revoke every entry link given out so far (raises the key version)","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdTawakkalnaSettingsRotate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tawakkalna/links":{"post":{"tags":["tawakkalna"],"summary":"A signed entry link for one survey: language, optional Nafath verification, consented attributes, expiry (501 until available)","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdTawakkalnaLinks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"lang":{"default":null,"anyOf":[{"type":"string","enum":["ar","en"]},{"type":"null"}]},"verify":{"default":false,"type":"boolean"},"claims":{"default":[],"maxItems":4,"type":"array","items":{"type":"string","enum":["locale","region","ageBand","gender"]}},"expiresInDays":{"default":90,"type":"integer","minimum":1,"maximum":365}},"required":["surveyId"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tawakkalna/flow/status":{"get":{"tags":["tawakkalna"],"summary":"Whether the Tawakkalna-ready flow and Nafath verification are available","operationId":"getV1TawakkalnaFlowStatus","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tawakkalna/flow/open":{"post":{"tags":["tawakkalna"],"summary":"Open a signed entry link: the first question (or verifyFirst), with only consented attributes kept","operationId":"postV1TawakkalnaFlowOpen","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"entry":{"type":"string","minLength":10,"maxLength":2048},"lang":{"type":"string","enum":["ar","en"]},"consent":{"type":"object","properties":{"consented":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","maxLength":32}},"values":{"default":{},"type":"object","propertyNames":{"type":"string","maxLength":32},"additionalProperties":{}}},"additionalProperties":false},"verification":{"type":"string","minLength":40,"maxLength":16384}},"required":["entry"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tawakkalna/flow/answer":{"post":{"tags":["tawakkalna"],"summary":"Answer the current question; the next question, a validation message, or the closing words","operationId":"postV1TawakkalnaFlowAnswer","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"flow":{"type":"string","minLength":40,"maxLength":16384},"reply":{"type":"string","maxLength":5000}},"required":["flow","reply"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tawakkalna/flow/back":{"post":{"tags":["tawakkalna"],"summary":"One question back","operationId":"postV1TawakkalnaFlowBack","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"flow":{"type":"string","minLength":40,"maxLength":16384}},"required":["flow"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tawakkalna/flow/verify/start":{"post":{"tags":["tawakkalna"],"summary":"GV-14: send a Nafath request to the respondent's app; answers the number to show","operationId":"postV1TawakkalnaFlowVerifyStart","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"entry":{"type":"string","minLength":10,"maxLength":2048},"nationalId":{"type":"string","maxLength":40},"locale":{"default":"ar","type":"string","enum":["ar","en"]}},"required":["entry","nationalId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tawakkalna/flow/verify/poll":{"post":{"tags":["tawakkalna"],"summary":"GV-14: Nafath status; on COMPLETED a sealed verification ticket (only a flag and a hashed id are stored)","operationId":"postV1TawakkalnaFlowVerifyPoll","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"entry":{"type":"string","minLength":10,"maxLength":2048},"flow":{"type":"string","minLength":40,"maxLength":16384}},"required":["entry","flow"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/nafath/status":{"get":{"tags":["auth"],"summary":"Whether staff sign-in with Nafath is available (coming soon until then)","operationId":"getV1AuthNafathStatus","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/nafath/start":{"post":{"tags":["auth"],"summary":"Start staff sign-in with Nafath: the number to pick in the Nafath app","operationId":"postV1AuthNafathStart","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nationalId":{"type":"string","maxLength":40},"locale":{"default":"ar","type":"string","enum":["ar","en"]}},"required":["nationalId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/nafath/poll":{"post":{"tags":["auth"],"summary":"Nafath sign-in status; on COMPLETED sets the session cookie","operationId":"postV1AuthNafathPoll","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"flow":{"type":"string","minLength":40,"maxLength":16384}},"required":["flow"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/me/nafath":{"get":{"tags":["auth"],"summary":"Whether Nafath is available and linked to this account (also in GET /v1/me session.nafathLinked)","operationId":"getV1MeNafath","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["auth"],"summary":"Unlink Nafath from this account","operationId":"deleteV1MeNafath","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/me/nafath/start":{"post":{"tags":["auth"],"summary":"Link your own Nafath identity after a step-up (MFA or password sign-in within 10 minutes, or password / totp in the body): send the request","operationId":"postV1MeNafathStart","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nationalId":{"type":"string","maxLength":40},"locale":{"default":"ar","type":"string","enum":["ar","en"]},"password":{"type":"string","minLength":1,"maxLength":200},"totp":{"type":"string","pattern":"^\\s*\\d{3}\\s?\\d{3}\\s*$"}},"required":["nationalId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/me/nafath/poll":{"post":{"tags":["auth"],"summary":"Link status; on COMPLETED the hashed id is linked to this account","operationId":"postV1MeNafathPoll","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"flow":{"type":"string","minLength":40,"maxLength":16384}},"required":["flow"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/encryption-key":{"get":{"tags":["encryption-key"],"summary":"TR-24 the organisation's own encryption key: whether the plan includes it (`cmk`), whether this server offers it, Sayvara's app id to grant, the key, its state (active or revoked) and how many secrets it seals","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdEncryptionKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"tenantKeyStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["encryption-key"],"summary":"Set or move the organisation's key (owner only, plan key `cmk`): checked with a wrap and unwrap first (409 CMK_KEY_REFUSED, 422 CMK_KEY_UNUSABLE, 503 CMK_KEY_UNAVAILABLE, 409 CMK_SERVICE_OFF); audited cmk.*","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdEncryptionKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"tenantKeyPutBody","response":"tenantKeyStatus"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts tenantKeyPutBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/encryption-key/check":{"post":{"tags":["encryption-key"],"summary":"Check the key now: restores a revoked key that works again, re-wraps after a rotation, marks a refusing key revoked (404 CMK_NOT_SET)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdEncryptionKeyCheck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"tenantKeyStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/approvals":{"get":{"tags":["approvals"],"summary":"03-2 / CL-07 the approvals inbox: pending (or, with status=decided, the latest decided) WhatsApp template submissions, mass sends, retention changes and AI auto-reply rule changes of the kinds the member's role may decide; the member's own requests are marked `mine`","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdApprovals","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"approvalInboxQuery","response":"approvalInbox"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/approvals/{approvalId}/approve":{"post":{"tags":["approvals"],"summary":"Approve a held action: it runs now (templates go to Meta, the campaign is scheduled, the retention is set, the AI auto-reply rules are saved or removed), then the decision is stored and audited (approval.approved); 403 APPROVAL_SELF for the maker, 409 APPROVAL_DECIDED, 409 APPROVAL_STALE when the action no longer applies, 404 APPROVAL_NOT_FOUND","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdApprovalsApprovalIdApprove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"approvalId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"approvalInboxItem"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/approvals/{approvalId}/reject":{"post":{"tags":["approvals"],"summary":"Reject a held action with a reason (a held campaign is cancelled); audited approval.rejected; 403 APPROVAL_SELF, 409 APPROVAL_DECIDED","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdApprovalsApprovalIdReject","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"approvalId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"approvalRejectBody","response":"approvalInboxItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts approvalRejectBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/approvals/policy":{"get":{"tags":["approvals"],"summary":"Which actions need a second member's approval: survey publish, WhatsApp template submission, mass sends, retention changes, AI auto-reply rules (Resolve Agent policy); always on and locked for a government organisation","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdApprovalsPolicy","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"approvalPolicy"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["approvals"],"summary":"Switch approval on or off for one action (owners and admins; audited approval.policy_set); 409 APPROVAL_POLICY_LOCKED for a government organisation or a platform-set approval","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdApprovalsPolicy","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"approvalPolicyPutBody","response":"approvalPolicy"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts approvalPolicyPutBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/access-control/roles":{"get":{"tags":["access-control"],"summary":"03-2 P2 the organisation's custom roles (each narrows a base role; a member's permissions are base INTERSECT custom), with how many members hold each and what the caller may choose per base role","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdAccessControlRoles","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["access-control"],"summary":"Create a custom role: English and Arabic names, base role (admin, manager, agent, analyst or viewer), a subset of its permissions that the caller also holds (400 PERMISSION_NOT_IN_BASE, 403 PERMISSION_ABOVE_YOURS, 409 NAME_TAKEN); audited custom_role.created","description":"Permission: `members.write`.","operationId":"postV1TenantsTenantIdAccessControlRoles","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/access-control/roles/{roleId}":{"patch":{"tags":["access-control"],"summary":"Rename a custom role or change its permissions (never the role the caller holds: 403 CANNOT_CHANGE_OWN_ROLE); audited custom_role.updated","description":"Permission: `members.write`.","operationId":"patchV1TenantsTenantIdAccessControlRolesRoleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"roleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["access-control"],"summary":"Delete a custom role nobody holds (409 CUSTOM_ROLE_IN_USE); audited custom_role.deleted","description":"Permission: `members.write`.","operationId":"deleteV1TenantsTenantIdAccessControlRolesRoleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"roleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/access-control/field-masks":{"get":{"tags":["access-control"],"summary":"Contact fields (phone, email, name) masked per base or custom role","description":"Permission: `members.write`.","operationId":"getV1TenantsTenantIdAccessControlFieldMasks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["access-control"],"summary":"Set the masked fields of one role key (a base role other than owner, or custom:<id>); no fields removes the mask; only an owner changes the mask on a role the caller holds (403 CANNOT_CHANGE_OWN_ROLE); audited field_mask.updated","description":"Permission: `members.write`.","operationId":"putV1TenantsTenantIdAccessControlFieldMasks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/access-control/ip-allowlist":{"get":{"tags":["access-control"],"summary":"The organisation's allowed networks (IPv4 and IPv6 ranges) and the caller's own address; an empty list allows every address","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdAccessControlIpAllowlist","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["access-control"],"summary":"Owners only (403 OWNER_ONLY): replace the allowed networks (at most 100); owners who passed two-step verification are never refused by the list; the caller's own address must be inside the new list (409 OWN_IP_NOT_ALLOWED, 400 INVALID_CIDR); audited ip_allowlist.updated","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdAccessControlIpAllowlist","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/status":{"get":{"tags":["stats"],"summary":"Whether the custom dashboard builder is on for the organisation","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdDashBuilderStatus","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/dashboards/{dashboardId}/spec":{"get":{"tags":["stats"],"summary":"How each widget of a stored dashboard is drawn (nine views and a text note), its own filter, and the one or two survey sources with mapped questions; a v2 board (W2) reads as its page 1 in that v1 shape, or with version=2 as its stored spec v2 (contracts boardSpecSchema; a v1 or empty board then reads as one page, contracts readBoardSpec; 409 CONFLICT { reason: unconvertible_widgets, readOnly, skipped } when Team C widgets have no v2 card (or, on a v2 board, are not on its page 1), or { reason: stored_spec_unreadable, readOnly } when the stored builder spec no longer parses)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdDashBuilderDashboardsDashboardIdSpec","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"version","in":"query","required":false,"schema":{"type":"string","enum":["1","2"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["stats"],"summary":"Save the builder spec of a dashboard (who may change the dashboard); 400 VALIDATION_FAILED on a v2 board, readable or not (save it with PUT board and a v2 body); edit rights and widget ids are checked again on the locked board","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdDashBuilderDashboardsDashboardIdSpec","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"version":{"default":1,"type":"number","const":1},"widgets":{"default":[],"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"view":{"type":"string","enum":["kpi","trend","bar","stacked","table","gauge","words","heatmap","quadrant","note"]},"metric":{"default":"nps","anyOf":[{"type":"string","enum":["nps","csat","ces","fcr"]},{"type":"string","pattern":"^map_[a-z0-9]{1,8}$"}]},"by":{"default":"orgUnit","type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"bucket":{"default":"week","type":"string","enum":["day","week","month"]},"limit":{"default":10,"type":"integer","minimum":1,"maximum":25},"order":{"default":"worst","type":"string","enum":["best","worst"]},"sentiment":{"default":"any","type":"string","enum":["any","negative","positive"]},"filter":{"default":{},"type":"object","properties":{"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"channel":{"type":"string","pattern":"^[a-z0-9_]{1,32}$"},"lang":{"type":"string","enum":["ar","en"]}},"additionalProperties":false},"text":{"type":"object","properties":{"en":{"type":"string","maxLength":2000},"ar":{"type":"string","maxLength":2000}},"required":["en","ar"],"additionalProperties":false}},"required":["id","view"],"additionalProperties":false}},"sources":{"default":{"surveys":[],"mapped":[]},"type":"object","properties":{"surveys":{"default":[],"maxItems":2,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"mapped":{"default":[],"maxItems":10,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^map_[a-z0-9]{1,8}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"a":{"type":"string","minLength":1,"maxLength":64},"b":{"type":"string","minLength":1,"maxLength":64}},"required":["key","label","a","b"],"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/dashboards":{"post":{"tags":["stats"],"summary":"Create a builder dashboard and its spec in one transaction; or a v2 body (contracts dashBoardSaveBody: spec v2 with pages, layout derived from page 1; 400 DASH_FREE_COLOUR, DASH_SLOT_IN_SPEC, DASH_LAYOUT_GAP; 400 VALIDATION_FAILED for an empty page 1, which the contracts allow but Team C's layout needs one widget)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdDashBuilderDashboards","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"dashBoardSaveBody","response":"dashBoardSaved"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"layout":{"type":"object","properties":{"widgets":{"minItems":1,"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"title":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"x":{"type":"integer","minimum":0,"maximum":11},"y":{"type":"integer","minimum":0,"maximum":200},"w":{"type":"integer","minimum":1,"maximum":12},"h":{"type":"integer","minimum":1,"maximum":8},"query":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"kpi"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"trend"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"bucket":{"type":"string","enum":["day","week","month"]}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"breakdown"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"by":{"type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"limit":{"type":"integer","minimum":1,"maximum":50},"order":{"type":"string","enum":["best","worst"]}},"required":["kind","metric","by","limit","order"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"distribution"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"themes"},"limit":{"type":"integer","minimum":1,"maximum":25},"sentiment":{"type":"string","enum":["any","negative","positive"]}},"required":["kind","limit","sentiment"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"volume"},"byChannel":{"type":"boolean"}},"required":["kind","byChannel"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"insight_card"},"cardId":{"type":"string","maxLength":240,"pattern":"^(new_theme|rising_theme|root_cause|concentration|negative_theme|urgent_comments|score_out_of_band):\\S{1,200}$"}},"required":["kind","cardId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"crosstab"},"rows":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"cols":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"confidence":{"type":"number"},"correction":{"type":"string","enum":["none","bonferroni","holm","bh"]}},"required":["kind","rows","cols"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"key_drivers"},"metric":{"type":"string","enum":["nps","csat","ces"]},"source":{"type":"string","enum":["questions","themes"]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"top":{"type":"integer","minimum":1,"maximum":15}},"required":["kind","metric","source","top"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"period_compare"},"metric":{"type":"string","enum":["nps","csat","ces"]},"compare":{"type":"string","enum":["previous_period","previous_year"]},"confidence":{"type":"number"}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"control_chart"},"metric":{"type":"string","enum":["nps","csat","ces"]},"bucket":{"type":"string","enum":["day"]},"measure":{"type":"string","enum":["score","share"]},"horizon":{"type":"integer","minimum":0,"maximum":30},"confidence":{"type":"number"}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"sample_check"},"metric":{"type":"string","enum":["nps","csat","ces"]},"by":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"target":{"type":"number","minimum":0.5,"maximum":50},"confidence":{"type":"number"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"limit":{"type":"integer","minimum":1,"maximum":50}},"required":["kind","metric","by","target","limit"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"kpi_trend"},"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"grain":{"type":"string","enum":["day","week","month","quarter"]},"periods":{"type":"integer","minimum":2,"maximum":92}},"required":["kind","key"],"additionalProperties":false}]}},"required":["id","title","x","y","w","h","query"],"additionalProperties":false}}},"required":["widgets"],"additionalProperties":false},"period":{"type":"object","properties":{"preset":{"default":"last_30_days","type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","this_quarter","last_quarter","custom"]},"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"compare":{"default":"previous_period","type":"string","enum":["previous_period","previous_year","none"]},"offsetMinutes":{"default":180,"type":"integer","minimum":-720,"maximum":840}},"additionalProperties":false},"spec":{"type":"object","properties":{"version":{"default":1,"type":"number","const":1},"widgets":{"default":[],"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"view":{"type":"string","enum":["kpi","trend","bar","stacked","table","gauge","words","heatmap","quadrant","note"]},"metric":{"default":"nps","anyOf":[{"type":"string","enum":["nps","csat","ces","fcr"]},{"type":"string","pattern":"^map_[a-z0-9]{1,8}$"}]},"by":{"default":"orgUnit","type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"bucket":{"default":"week","type":"string","enum":["day","week","month"]},"limit":{"default":10,"type":"integer","minimum":1,"maximum":25},"order":{"default":"worst","type":"string","enum":["best","worst"]},"sentiment":{"default":"any","type":"string","enum":["any","negative","positive"]},"filter":{"default":{},"type":"object","properties":{"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"channel":{"type":"string","pattern":"^[a-z0-9_]{1,32}$"},"lang":{"type":"string","enum":["ar","en"]}},"additionalProperties":false},"text":{"type":"object","properties":{"en":{"type":"string","maxLength":2000},"ar":{"type":"string","maxLength":2000}},"required":["en","ar"],"additionalProperties":false}},"required":["id","view"],"additionalProperties":false}},"sources":{"default":{"surveys":[],"mapped":[]},"type":"object","properties":{"surveys":{"default":[],"maxItems":2,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"mapped":{"default":[],"maxItems":10,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^map_[a-z0-9]{1,8}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"a":{"type":"string","minLength":1,"maxLength":64},"b":{"type":"string","minLength":1,"maxLength":64}},"required":["key","label","a","b"],"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false}},"required":["name","layout","spec"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/dashboards/{dashboardId}/board":{"put":{"tags":["stats"],"summary":"Save the name, layout, period and spec of a builder dashboard in one transaction (who may change the dashboard); or a v2 body (contracts dashBoardSaveBody, as on create, page 1 not empty); a v1 body on a v2 board is 400 VALIDATION_FAILED; a v2 body over a board the v2 read answers 409 for is 409 CONFLICT (same details, including Team C widgets added to a v2 board outside its page 1), except that replaceUnreadable=true lets it replace a stored spec that no longer parses (the stored origin kept when it still parses; a broken v1 spec only when every layout widget has a v2 card, else 409 skipped; audited replacedUnreadable); audited dash_builder.board_saved","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdDashBuilderDashboardsDashboardIdBoard","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"replaceUnreadable","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}}],"x-sayvara-contract":{"body":"dashBoardSaveBody","response":"dashBoardSaved"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"layout":{"type":"object","properties":{"widgets":{"minItems":1,"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"title":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"x":{"type":"integer","minimum":0,"maximum":11},"y":{"type":"integer","minimum":0,"maximum":200},"w":{"type":"integer","minimum":1,"maximum":12},"h":{"type":"integer","minimum":1,"maximum":8},"query":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"kpi"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"trend"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"bucket":{"type":"string","enum":["day","week","month"]}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"breakdown"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"by":{"type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"limit":{"type":"integer","minimum":1,"maximum":50},"order":{"type":"string","enum":["best","worst"]}},"required":["kind","metric","by","limit","order"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"distribution"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"themes"},"limit":{"type":"integer","minimum":1,"maximum":25},"sentiment":{"type":"string","enum":["any","negative","positive"]}},"required":["kind","limit","sentiment"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"volume"},"byChannel":{"type":"boolean"}},"required":["kind","byChannel"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"insight_card"},"cardId":{"type":"string","maxLength":240,"pattern":"^(new_theme|rising_theme|root_cause|concentration|negative_theme|urgent_comments|score_out_of_band):\\S{1,200}$"}},"required":["kind","cardId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"crosstab"},"rows":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"cols":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"confidence":{"type":"number"},"correction":{"type":"string","enum":["none","bonferroni","holm","bh"]}},"required":["kind","rows","cols"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"key_drivers"},"metric":{"type":"string","enum":["nps","csat","ces"]},"source":{"type":"string","enum":["questions","themes"]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"top":{"type":"integer","minimum":1,"maximum":15}},"required":["kind","metric","source","top"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"period_compare"},"metric":{"type":"string","enum":["nps","csat","ces"]},"compare":{"type":"string","enum":["previous_period","previous_year"]},"confidence":{"type":"number"}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"control_chart"},"metric":{"type":"string","enum":["nps","csat","ces"]},"bucket":{"type":"string","enum":["day"]},"measure":{"type":"string","enum":["score","share"]},"horizon":{"type":"integer","minimum":0,"maximum":30},"confidence":{"type":"number"}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"sample_check"},"metric":{"type":"string","enum":["nps","csat","ces"]},"by":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"target":{"type":"number","minimum":0.5,"maximum":50},"confidence":{"type":"number"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"limit":{"type":"integer","minimum":1,"maximum":50}},"required":["kind","metric","by","target","limit"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"kpi_trend"},"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"grain":{"type":"string","enum":["day","week","month","quarter"]},"periods":{"type":"integer","minimum":2,"maximum":92}},"required":["kind","key"],"additionalProperties":false}]}},"required":["id","title","x","y","w","h","query"],"additionalProperties":false}}},"required":["widgets"],"additionalProperties":false},"period":{"type":"object","properties":{"preset":{"default":"last_30_days","type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","this_quarter","last_quarter","custom"]},"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"compare":{"default":"previous_period","type":"string","enum":["previous_period","previous_year","none"]},"offsetMinutes":{"default":180,"type":"integer","minimum":-720,"maximum":840}},"additionalProperties":false},"spec":{"type":"object","properties":{"version":{"default":1,"type":"number","const":1},"widgets":{"default":[],"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"view":{"type":"string","enum":["kpi","trend","bar","stacked","table","gauge","words","heatmap","quadrant","note"]},"metric":{"default":"nps","anyOf":[{"type":"string","enum":["nps","csat","ces","fcr"]},{"type":"string","pattern":"^map_[a-z0-9]{1,8}$"}]},"by":{"default":"orgUnit","type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"bucket":{"default":"week","type":"string","enum":["day","week","month"]},"limit":{"default":10,"type":"integer","minimum":1,"maximum":25},"order":{"default":"worst","type":"string","enum":["best","worst"]},"sentiment":{"default":"any","type":"string","enum":["any","negative","positive"]},"filter":{"default":{},"type":"object","properties":{"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"channel":{"type":"string","pattern":"^[a-z0-9_]{1,32}$"},"lang":{"type":"string","enum":["ar","en"]}},"additionalProperties":false},"text":{"type":"object","properties":{"en":{"type":"string","maxLength":2000},"ar":{"type":"string","maxLength":2000}},"required":["en","ar"],"additionalProperties":false}},"required":["id","view"],"additionalProperties":false}},"sources":{"default":{"surveys":[],"mapped":[]},"type":"object","properties":{"surveys":{"default":[],"maxItems":2,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"mapped":{"default":[],"maxItems":10,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^map_[a-z0-9]{1,8}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"a":{"type":"string","minLength":1,"maxLength":64},"b":{"type":"string","minLength":1,"maxLength":64}},"required":["key","label","a","b"],"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false}},"required":["name","layout","spec"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/dashboards/{dashboardId}/access":{"get":{"tags":["stats"],"summary":"What the caller may do with one dashboard: change it (edit), make links (share) and download or print it (export)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdDashBuilderDashboardsDashboardIdAccess","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/dashboards/{dashboardId}/data":{"get":{"tags":["stats"],"summary":"Widget results of a builder dashboard in the caller scope, each with its base, low-base flag and data-as-of stamp. page = a page id of a v2 board (W2b; default the first; a v1 board has the one page main; 404 for an unknown page, and for any page when the stored v2 spec no longer parses); orgUnitIds (comma list, in the caller scope, else 403 STATS_DASHBOARD_SCOPE), channels and direction lay over the board filter bar for this read (contracts board-filters.ts applyQueryFilters); an empty list (orgUnitIds=, channels=) or direction=all is an explicit all over the bar, while a key the page pins, and a channel page's channel, are binding and never overridden by the query. A card with no v1 view, its own period, a page that pins its period, or filters that narrow (units, channels, direction: from the bar, the pins, the channel page or the query) gives data null and empty source_pending until they are applied; every card does when the stored v2 spec no longer parses","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdDashBuilderDashboardsDashboardIdData","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"preset","in":"query","required":false,"schema":{"type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","this_quarter","last_quarter","custom"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"compare","in":"query","required":false,"schema":{"type":"string","enum":["previous_period","previous_year","none"]}},{"name":"offsetMinutes","in":"query","required":false,"schema":{"type":"integer","minimum":-720,"maximum":840}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["ar","en"]}},{"name":"page","in":"query","required":false,"schema":{"type":"string","maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"}},{"name":"orgUnitIds","in":"query","required":false,"schema":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},{"name":"channels","in":"query","required":false,"schema":{"maxItems":50,"type":"array","items":{"type":"string","enum":["whatsapp","sms","email","web","qr","widget","voice","kiosk","in_app","social"]}}},{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["all","inbound","outbound"]}}],"x-sayvara-contract":{"query":"dashBoardDataQuery","response":"dashBoardDataW2"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/dashboards/{dashboardId}/export":{"get":{"tags":["stats"],"summary":"Download or print a builder dashboard in Arabic or English: html (print page for PDF), pptx, xlsx or docx; the numbers of the data route, low-base groups shown as a dash; page, orgUnitIds, channels and direction as on the data route (the file shows that page and names it, with the narrowing filters in force, in its heading and meta lines; an empty page says it has no cards; 404 for an unknown page, 403 for a unit outside the caller scope), a source_pending card as not shown in this view; audited with the page id and the query filters. format=check runs the access, unit (403), page (404) and limit checks only (no file, not counted, not audited)","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdDashBuilderDashboardsDashboardIdExport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"preset","in":"query","required":false,"schema":{"type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","this_quarter","last_quarter","custom"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"compare","in":"query","required":false,"schema":{"type":"string","enum":["previous_period","previous_year","none"]}},{"name":"offsetMinutes","in":"query","required":false,"schema":{"type":"integer","minimum":-720,"maximum":840}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["ar","en"]}},{"name":"page","in":"query","required":false,"schema":{"type":"string","maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"}},{"name":"orgUnitIds","in":"query","required":false,"schema":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},{"name":"channels","in":"query","required":false,"schema":{"maxItems":50,"type":"array","items":{"type":"string","enum":["whatsapp","sms","email","web","qr","widget","voice","kiosk","in_app","social"]}}},{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["all","inbound","outbound"]}},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["html","pptx","xlsx","docx","check"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/preview":{"post":{"tags":["stats"],"summary":"Widget results of an unsaved layout and spec (the builder live preview); or a v2 body (contracts dashBoardPreviewBody: one page of a spec v2, cards without a v1 view marked empty source_pending)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdDashBuilderPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"dashBoardPreviewBody","response":"dashBoardDataExtras"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"layout":{"type":"object","properties":{"widgets":{"minItems":1,"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"title":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"x":{"type":"integer","minimum":0,"maximum":11},"y":{"type":"integer","minimum":0,"maximum":200},"w":{"type":"integer","minimum":1,"maximum":12},"h":{"type":"integer","minimum":1,"maximum":8},"query":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"kpi"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"trend"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"bucket":{"type":"string","enum":["day","week","month"]}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"breakdown"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"by":{"type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"limit":{"type":"integer","minimum":1,"maximum":50},"order":{"type":"string","enum":["best","worst"]}},"required":["kind","metric","by","limit","order"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"distribution"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"themes"},"limit":{"type":"integer","minimum":1,"maximum":25},"sentiment":{"type":"string","enum":["any","negative","positive"]}},"required":["kind","limit","sentiment"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"volume"},"byChannel":{"type":"boolean"}},"required":["kind","byChannel"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"insight_card"},"cardId":{"type":"string","maxLength":240,"pattern":"^(new_theme|rising_theme|root_cause|concentration|negative_theme|urgent_comments|score_out_of_band):\\S{1,200}$"}},"required":["kind","cardId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"crosstab"},"rows":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"cols":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"confidence":{"type":"number"},"correction":{"type":"string","enum":["none","bonferroni","holm","bh"]}},"required":["kind","rows","cols"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"key_drivers"},"metric":{"type":"string","enum":["nps","csat","ces"]},"source":{"type":"string","enum":["questions","themes"]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"top":{"type":"integer","minimum":1,"maximum":15}},"required":["kind","metric","source","top"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"period_compare"},"metric":{"type":"string","enum":["nps","csat","ces"]},"compare":{"type":"string","enum":["previous_period","previous_year"]},"confidence":{"type":"number"}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"control_chart"},"metric":{"type":"string","enum":["nps","csat","ces"]},"bucket":{"type":"string","enum":["day"]},"measure":{"type":"string","enum":["score","share"]},"horizon":{"type":"integer","minimum":0,"maximum":30},"confidence":{"type":"number"}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"sample_check"},"metric":{"type":"string","enum":["nps","csat","ces"]},"by":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"target":{"type":"number","minimum":0.5,"maximum":50},"confidence":{"type":"number"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"limit":{"type":"integer","minimum":1,"maximum":50}},"required":["kind","metric","by","target","limit"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"kpi_trend"},"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"grain":{"type":"string","enum":["day","week","month","quarter"]},"periods":{"type":"integer","minimum":2,"maximum":92}},"required":["kind","key"],"additionalProperties":false}]}},"required":["id","title","x","y","w","h","query"],"additionalProperties":false}}},"required":["widgets"],"additionalProperties":false},"spec":{"type":"object","properties":{"version":{"default":1,"type":"number","const":1},"widgets":{"default":[],"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"view":{"type":"string","enum":["kpi","trend","bar","stacked","table","gauge","words","heatmap","quadrant","note"]},"metric":{"default":"nps","anyOf":[{"type":"string","enum":["nps","csat","ces","fcr"]},{"type":"string","pattern":"^map_[a-z0-9]{1,8}$"}]},"by":{"default":"orgUnit","type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"bucket":{"default":"week","type":"string","enum":["day","week","month"]},"limit":{"default":10,"type":"integer","minimum":1,"maximum":25},"order":{"default":"worst","type":"string","enum":["best","worst"]},"sentiment":{"default":"any","type":"string","enum":["any","negative","positive"]},"filter":{"default":{},"type":"object","properties":{"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"channel":{"type":"string","pattern":"^[a-z0-9_]{1,32}$"},"lang":{"type":"string","enum":["ar","en"]}},"additionalProperties":false},"text":{"type":"object","properties":{"en":{"type":"string","maxLength":2000},"ar":{"type":"string","maxLength":2000}},"required":["en","ar"],"additionalProperties":false}},"required":["id","view"],"additionalProperties":false}},"sources":{"default":{"surveys":[],"mapped":[]},"type":"object","properties":{"surveys":{"default":[],"maxItems":2,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"mapped":{"default":[],"maxItems":10,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^map_[a-z0-9]{1,8}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"a":{"type":"string","minLength":1,"maxLength":64},"b":{"type":"string","minLength":1,"maxLength":64}},"required":["key","label","a","b"],"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false},"period":{"default":{"preset":"last_30_days","compare":"previous_period","offsetMinutes":180},"type":"object","properties":{"preset":{"default":"last_30_days","type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","this_quarter","last_quarter","custom"]},"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"compare":{"default":"previous_period","type":"string","enum":["previous_period","previous_year","none"]},"offsetMinutes":{"default":180,"type":"integer","minimum":-720,"maximum":840}},"additionalProperties":false},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"lang":{"default":"en","type":"string","enum":["ar","en"]}},"required":["layout","spec"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/templates":{"get":{"tags":["stats"],"summary":"The template gallery: system templates and the organisation's own (most recently saved first)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdDashBuilderTemplates","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"dashTemplateList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Save a board the caller sees as an organisation template (tenant admin: owner, or admin with tenant.update; else 403 DASH_TEMPLATE_ADMIN_ONLY); the board as the page editor reads it, without origin and unit pins; 422 VALIDATION_FAILED for a board with no card on its first page; 409 CONFLICT for a board the page editor shows read-only; 422 VALIDATION_FAILED past 200 templates; 429 RATE_LIMITED past 30 builder settings writes a minute per person; audited dash_builder.template_created","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdDashBuilderTemplates","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"dashTenantTemplateCreateBody","response":"dashTenantTemplateCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts dashTenantTemplateCreateBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/templates/{scope}/{ref}":{"get":{"tags":["stats"],"summary":"One template with its summary (a system template by key, a tenant template by id); 404 DASH_TEMPLATE_NOT_FOUND","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdDashBuilderTemplatesScopeRef","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"scope","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ref","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"dashTemplateDetail"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/dashboards/from-template":{"post":{"tags":["stats"],"summary":"A new private board copied from a system or tenant template (snapshot, origin in the spec); channel-pack pages for channels not connected are dropped and listed; 422 DASH_SLOT_UNMAPPED { missing } (system), 422 VALIDATION_FAILED { droppedPages } when no page is left, 403 STATS_DASHBOARD_SCOPE for a unit outside the caller's scope, 409 CONFLICT { reason: template_invalid } for a tenant template that no longer makes a valid board, 404 DASH_TEMPLATE_NOT_FOUND","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdDashBuilderDashboardsFromTemplate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"dashFromTemplateBody","response":"dashFromTemplateResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts dashFromTemplateBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/templates/{templateId}":{"put":{"tags":["stats"],"summary":"Save an organisation template again (version + 1): from a board again and / or a new title or description; tenant admin only; 404 DASH_TEMPLATE_NOT_FOUND; 429 RATE_LIMITED; audited dash_builder.template_saved","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdDashBuilderTemplatesTemplateId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"templateId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"dashTenantTemplateSaveBody","response":"dashTenantTemplateCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts dashTenantTemplateSaveBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["stats"],"summary":"Delete an organisation template (boards copied from it keep their origin); tenant admin only; 404 DASH_TEMPLATE_NOT_FOUND; 429 RATE_LIMITED; audited dash_builder.template_deleted","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdDashBuilderTemplatesTemplateId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"templateId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/dashboards/{dashboardId}/assignments":{"get":{"tags":["stats"],"summary":"Who a board is assigned to (members, roles, units and their sub-units; view only) and the roles whose home board it is; only who may change the board or a tenant admin (else 403 STATS_DASHBOARD_OWNER); a unit-scoped editor sees only the unit targets inside their scope","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdDashBuilderDashboardsDashboardIdAssignments","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"dashAssignmentsView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["stats"],"summary":"Replace who a board is assigned to (who may change the board, else 403 STATS_DASHBOARD_OWNER); a unit added must be inside the caller's scope (403 STATS_DASHBOARD_SCOPE; a stored unit outside it is kept); 400 VALIDATION_FAILED { unknown } (checked after the defaults admin check, before scope) for a member, unit (or a newly added archived unit) or custom role not in the organisation; any defaultFor change needs a tenant admin (403 DASH_DEFAULT_ADMIN_ONLY); a kept default whose role is no longer a target is 400 DASH_DEFAULT_NOT_TARGET; answers the boards moved defaults left; 429 RATE_LIMITED past 30 builder settings writes a minute per person; audited dash_builder.assignments_saved","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdDashBuilderDashboardsDashboardIdAssignments","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"dashAssignments","response":"dashAssignmentsResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts dashAssignments"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/my-boards":{"get":{"tags":["stats"],"summary":"The caller's boards (assigned to them and visible in their scope, plus their own home pick) and their home board: own pick, then custom-role default, then base-role default","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdDashBuilderMyBoards","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"dashMyBoards"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/my-boards/home":{"put":{"tags":["stats"],"summary":"Set or clear (null) the caller's own home board; 404 DASH_BOARD_NOT_VISIBLE for a board they cannot see; 403 DASH_HOME_NO_MEMBERSHIP for a caller with no membership row (a support session); 429 RATE_LIMITED; audited dash_builder.home_set; answers my-boards","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdDashBuilderMyBoardsHome","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"dashMyHomeBody","response":"dashMyBoards"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts dashMyHomeBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/dashboards/{dashboardId}/links":{"get":{"tags":["stats"],"summary":"Secure view-only links to a dashboard: the caller's own, or all for whoever may change it","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdDashBuilderDashboardsDashboardIdLinks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Make a secure view-only link (shown once; expires in at most 90 days; plan key reports.share_links)","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdDashBuilderDashboardsDashboardIdLinks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":80},"expiresInDays":{"default":30,"type":"integer","minimum":1,"maximum":90}},"required":["label"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dash-builder/links/{linkId}/revoke":{"post":{"tags":["stats"],"summary":"Stop a secure link (its maker, or whoever may change the dashboard)","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdDashBuilderLinksLinkIdRevoke","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"linkId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/shared-boards/open":{"post":{"tags":["stats"],"summary":"Open a secure builder-dashboard link without signing in: the numbers in the maker scope (a v2 board, W2, reads as its page 1; a card with no v1 view, its own period, or a page whose filters narrow (a pinned period; or the filters in force after the board bar, the page pins and a channel page's own channel narrow units, channels or direction, so an 'all' pin over a narrowing bar draws and a channel page is pending) gives data null and empty source_pending; every card does when the stored v2 spec no longer parses); 404 SHARED_LINK_INVALID, 410 SHARED_LINK_UNAVAILABLE","operationId":"postV1SharedBoardsOpen","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"},"lang":{"default":"en","type":"string","enum":["ar","en"]}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/mcp":{"post":{"tags":["mcp"],"summary":"MCP endpoint (JSON-RPC 2.0): initialize, ping, tools/list and tools/call for the read-only tools get_results, get_themes, list_tickets, list_surveys and ask; one JSON answer per POST (202 for notifications only); every call is audited; 403 when the key holds a write scope; 404 while the integrations.mcp switch is off; a svk_test_ key is served only while integrations.mcp_test_mode is on (403 API_KEY_TEST_MODE otherwise) and runs the read tools on its own organisation with no confirmation step, while ask is left out of tools/list and refused (tool error API_KEY_TEST_MODE)","operationId":"postV1Mcp","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["mcp"],"summary":"No server-to-client stream: answers 405 (Allow: POST)","operationId":"getV1Mcp","security":[],"responses":{"405":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["mcp"],"summary":"No sessions to end: answers 405 (Allow: POST)","operationId":"deleteV1Mcp","security":[],"responses":{"405":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/odata":{"get":{"tags":["odata"],"summary":"OData v4 service document of the Power BI feed (entity sets)","operationId":"getV1Odata","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/odata/{set}":{"get":{"tags":["odata"],"summary":"One page of an entity set (Responses, ResponseThemes, Tickets, Surveys, OrgUnits, DailyScores) or $metadata (CSDL XML); $filter, $select, $top, $count, $skiptoken; @odata.nextLink pages by key (Prefer: odata.maxpagesize up to 5000); DailyScores needs a Date range of at most 366 days (400 ODATA_UNBOUNDED); no free text or contact identity","operationId":"getV1OdataSet","security":[],"parameters":[{"name":"set","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/odata/{set}/{sub}":{"get":{"tags":["odata"],"summary":"The number of rows of an entity set ($count), with $filter","operationId":"getV1OdataSetSub","security":[],"parameters":[{"name":"set","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sub","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sql-access":{"get":{"tags":["sql-access"],"summary":"Read replica address, the semantic views a login may read, the statement timeout and the SQL logins (no secrets), newest first (plan: group_integrations)","description":"Permission: `data_access.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSqlAccess","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sqlAccessOverview"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sql-access/credentials":{"post":{"tags":["sql-access"],"summary":"Issue the caller's own read-only SQL login (logins are personal: userId, if sent, must be the caller, else 403 SQL_ACCESS_SELF_ONLY); the secret is shown once, to the holder; the holder's org-unit scope applies to every query; 409 SQL_LOGIN_EXISTS","description":"Permission: `data_access.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSqlAccessCredentials","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"sqlAccessIssueInput","response":"sqlAccessSecret"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sqlAccessIssueInput"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sql-access/credentials/{id}/rotate":{"post":{"tags":["sql-access"],"summary":"New secret for the caller's own live SQL login (shown once); the old one stops for new connections; another member's login: 403 SQL_ACCESS_SELF_ONLY","description":"Permission: `data_access.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSqlAccessCredentialsIdRotate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sqlAccessSecret"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sql-access/credentials/{id}":{"delete":{"tags":["sql-access"],"summary":"Revoke any SQL login of the tenant (an owner or admin may revoke another member's): the database user is removed and open sessions read no more rows","description":"Permission: `data_access.manage`.","operationId":"deleteV1TenantsTenantIdSqlAccessCredentialsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/commerce-stores":{"get":{"tags":["integrations"],"summary":"Online stores (IN-10): Salla and Zid, each with whether Sayvara's app is available and the connected store","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCommerceStores","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"commerceStoreList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/commerce-stores/{provider}":{"patch":{"tags":["integrations"],"summary":"The survey sent after an order (null = the only live survey) and the order statuses that start it","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdCommerceStoresProvider","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"commerceStorePatch","response":"commerceStoreItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts commerceStorePatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect the store (its vault secrets go too); the app stays in the store until the merchant removes it","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdCommerceStoresProvider","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/commerce-stores/{provider}/install":{"post":{"tags":["integrations"],"summary":"Start the install: the platform's consent URL, and a 10-minute install cookie; 409 COMMERCE_NOT_CONFIGURED while the app is not registered","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCommerceStoresProviderInstall","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"commerceInstallStart"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/integrations/commerce/{provider}/callback":{"get":{"tags":["integrations"],"summary":"OAuth callback of the Salla / Zid app: redirects to /integrations/commerce?connected= or ?failed=, or to /integrations/commerce/{provider}/install without a Sayvara state","operationId":"getV1IntegrationsCommerceProviderCallback","security":[],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"302":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/hooks/commerce/{provider}":{"post":{"tags":["hooks"],"summary":"Salla (HMAC X-Salla-Signature) or Zid (per-store Basic credentials) order and uninstall webhook; a delivered order queues one survey","operationId":"postV1HooksCommerceProvider","security":[{"signature":[]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connectors":{"get":{"tags":["integrations"],"summary":"ITSM and help-desk connectors (ServiceNow, Zendesk, HubSpot, Freshdesk, Jira Service Management, Zoho Desk, Zoho CRM) with their state: needs_credentials, connected, test_failed, paused or unavailable","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdConnectors","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connectors/{id}":{"put":{"tags":["integrations"],"summary":"Connect or reconnect with the connector's own form; tests the connection; values to copy (webhook secret, hook token) are in this answer only","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdConnectorsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["integrations"],"summary":"Pause or resume the connection ({ status })","description":"Permission: `integrations.manage`.","operationId":"patchV1TenantsTenantIdConnectorsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect (the vault secrets go too)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdConnectorsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connectors/{id}/test":{"post":{"tags":["integrations"],"summary":"Test the stored connection again","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdConnectorsIdTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connectors/{id}/hook-token":{"post":{"tags":["integrations"],"summary":"A new hook token for providers that do not sign webhooks (Freshdesk, Zoho Desk), shown once; the old one works 7 days more","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdConnectorsIdHookToken","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/hooks/itsm/{provider}/{tenantId}":{"post":{"tags":["hooks"],"summary":"ServiceNow or Zendesk webhook (signed), the first URL of these two: handled like the help-desk webhook","operationId":"postV1HooksItsmProviderTenantId","security":[{"signature":[]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/hooks/helpdesk/{provider}/{tenantId}":{"post":{"tags":["hooks"],"summary":"ServiceNow, Zendesk, HubSpot, Freshdesk, Jira Service Management, Zoho Desk or Zoho CRM webhook (signed or hook token): a ticket was closed, confirmed with the provider's API before it reaches the intake","operationId":"postV1HooksHelpdeskProviderTenantId","security":[{"signature":[]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/call-quality/sources":{"get":{"tags":["integrations"],"summary":"AI-19 call-quality sources (Telyzer) with their state: on_request (an add-on, available on request), unavailable, needs_credentials, connected, test_failed or paused (organisation-wide members only)","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdCallQualitySources","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/call-quality/sources/{id}":{"put":{"tags":["integrations"],"summary":"Connect or reconnect a call-quality source with the organisation's own key (needs the add-on: 403 ENTITLEMENT_REQUIRED call_quality.telyzer without it); tests the connection; 409 CALL_QUALITY_SOURCE_BUSY while another connect, test or disconnect of this source runs; after a 503 on a reconnect, run the test again","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdCallQualitySourcesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["integrations"],"summary":"Pause or resume the call-quality source ({ status })","description":"Permission: `integrations.manage`.","operationId":"patchV1TenantsTenantIdCallQualitySourcesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect the call-quality source (the vault secrets go too); 409 CALL_QUALITY_SOURCE_BUSY while another connect, test or disconnect of this source runs","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdCallQualitySourcesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/call-quality/sources/{id}/test":{"post":{"tags":["integrations"],"summary":"Test the stored call-quality connection again; 409 CALL_QUALITY_SOURCE_BUSY while another connect, test or disconnect of this source runs","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdCallQualitySourcesIdTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/call-quality/sources/telyzer/native":{"get":{"tags":["integrations"],"summary":"Telyzer native webhook card: the URL (null until created), staff verification, whether an endpoint secret is saved (never the value), the missed-call settings and the live surveys to choose from (organisation-wide members only)","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdCallQualitySourcesTelyzerNative","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["integrations"],"summary":"Create (or adopt) the Telyzer native webhook connection and show its URL; audited","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdCallQualitySourcesTelyzerNative","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect the Telyzer native webhook: pause the connection, revoke both endpoint secrets (the vault copies go too), clear staff verification and the missed-call confirmation; audited","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdCallQualitySourcesTelyzerNative","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["integrations"],"summary":"Missed-call settings: confirm Telyzer's own missed-call WhatsApp is off ({ telyzerMissedCallWhatsapp: false, confirm: true }), surveyId (a live survey), windowHours 1-168, maxAgeMinutes 15-1440, hourlyCap 1-100, dailyCap 1-1000; audited","description":"Permission: `integrations.manage`.","operationId":"patchV1TenantsTenantIdCallQualitySourcesTelyzerNative","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/call-quality/sources/telyzer/native/secret":{"put":{"tags":["integrations"],"summary":"Save the endpoint secret Telyzer shows for this URL ({ secret }, write-only); the previous secret stays valid 24 h; audited without the value","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdCallQualitySourcesTelyzerNativeSecret","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/integrations/omnibrand/connection":{"get":{"tags":["integrations"],"summary":"OmniBrand outbound connection: state, the workspace masked, repliesEnabled, the webhook state and the last test (organisation-wide members only; 404 while the install's OmniBrand outbound flag is off)","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdIntegrationsOmnibrandConnection","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["integrations"],"summary":"Connect or reconnect with the workspace key (vault only, never answered) and workspace id; repliesEnabled off by default; registers Sayvara's webhook unless registerWebhook is false; tests the key; audited; 409 OMNIBRAND_CONNECTION_BUSY while another change runs, 409 CONNECTOR_CHANGED when another change was saved meanwhile, 409 OMNIBRAND_CONNECTION_LOCK_LOST when the change lease may have lapsed before the save, 503 OMNIBRAND_LOCK_UNAVAILABLE while Redis does not answer; 422 OMNIBRAND_SUBSCRIPTION_LIMIT / OMNIBRAND_WORKSPACE_REJECTED, 409 OMNIBRAND_NO_INTEGRATION, 503 OMNIBRAND_RECONNECT_INCOMPLETE (connect again); 429 RATE_LIMITED past 5 per tenant per minute","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdIntegrationsOmnibrandConnection","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"apiKey":{"type":"string","pattern":"^ob_(live|test)_[A-Za-z0-9_-]{8,200}$"},"workspaceId":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"repliesEnabled":{"default":false,"type":"boolean"},"registerWebhook":{"default":true,"type":"boolean"},"brands":{"type":"array","items":{"type":"string","minLength":1,"maxLength":80}}},"required":["apiKey","workspaceId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect: deletes Sayvara's webhook subscriptions at OmniBrand and the key, then the connection; answers the subscription ids OmniBrand refused to delete; audited (connector.disconnected, and connector.release_incomplete when something stayed). While the install's OmniBrand outbound flag is off: removes the key and the connection without calling OmniBrand and answers every stored subscription id (offline: true); unit-scoped members 404","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdIntegrationsOmnibrandConnection","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/integrations/omnibrand/connection/test":{"post":{"tags":["integrations"],"summary":"Test the stored OmniBrand key again; audited; 429 RATE_LIMITED past 6 per tenant per minute","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdIntegrationsOmnibrandConnectionTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/integrations/omnibrand/accounts":{"get":{"tags":["integrations"],"summary":"OmniBrand account picker: the workspace's social accounts pulled live from OmniBrand (one brand group: the workspace), each marked selected by the stored allow-list (filter all / selected / malformed), and the stored entries that are not account ids (otherEntries); organisation-wide members only; 404 while the install's OmniBrand outbound flag or the tenant's integrations.sister_native flag is off, 404 OMNIBRAND_NOT_CONNECTED, 409 OMNIBRAND_KEY_INVALID (OmniBrand no longer knows the key, or the stored key has the wrong form, is unreadable or is gone from the vault: connect again), 409 OMNIBRAND_KEY_SCOPE (the key lacks read access), 502 OMNIBRAND_UNAVAILABLE; 429 RATE_LIMITED past 10 per tenant per minute","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdIntegrationsOmnibrandAccounts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["integrations"],"summary":"Choose the OmniBrand accounts that feed Sayvara ({ accountIds }): pulled again live, 400 OMNIBRAND_UNKNOWN_ACCOUNTS (nothing written) for ids OmniBrand does not list; stores accountIds plus the otherEntries (kept); an empty result removes the list so every account flows ([] with no otherEntries means all accounts, not none; sending every id pins today's accounts, so ones added afterwards at OmniBrand do not flow until ticked; an account id OmniBrand no longer lists stays as an otherEntry); a malformed stored list is replaced (nothing kept from it), and [] over it is refused with 400 OMNIBRAND_LIST_MALFORMED (nothing written); the body takes up to 400 ids before duplicates are dropped (400 BAD_REQUEST past that); 400 OMNIBRAND_TOO_MANY past 100 entries; audited (connector.accounts_selected, counts only); 404 / 409 / 502 as GET; 409 OMNIBRAND_CONNECTION_BUSY / CONNECTOR_CHANGED, 409 OMNIBRAND_CONNECTION_LOCK_LOST (the change lease may have lapsed before the write: nothing written), 503 OMNIBRAND_LOCK_UNAVAILABLE (Redis does not answer: nothing written); 429 RATE_LIMITED past 5 per tenant per minute","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdIntegrationsOmnibrandAccounts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"accountIds":{"maxItems":400,"type":"array","items":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"}}},"required":["accountIds"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connect/salesforce":{"get":{"tags":["integrations"],"summary":"Connect with Salesforce: the permission set Sayvara assigns and the verified grants (plan: group_integrations; 501 until the platform app is set)","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdConnectSalesforce","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connect/salesforce/start":{"post":{"tags":["integrations"],"summary":"Start Connect with Salesforce for one org ({ myDomain }): sets a short sealed flow cookie and answers the Salesforce sign-in URL","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdConnectSalesforceStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connect/salesforce/{host}":{"delete":{"tags":["integrations"],"summary":"Forget the grant for an org: platform tokens stop and the refresh token is revoked and dropped from the vault","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdConnectSalesforceHost","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"host","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/connect/salesforce/callback":{"get":{"tags":["integrations"],"summary":"Salesforce returns the browser here with code and state (flow cookie): sets up the permission set and the reference field, records the grant; 303 to Integrations > CRM with salesforce=connected or salesforce=error&code=<code>","operationId":"getV1ConnectSalesforceCallback","security":[],"responses":{"303":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/review-connections":{"get":{"tags":["integrations"],"summary":"Review connections (Google Business Profile, App Store, Google Play; Facebook Page and Instagram while reviews.meta_direct is on) with their state: needs_credentials, connected, test_failed, paused or unavailable; the Meta entries carry reason app_review_pending until META_APP_REVIEW_APPROVED=on","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdReviewConnections","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/review-connections/google-business/start":{"post":{"tags":["integrations"],"summary":"Start Connect with Google: answers the consent URL","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewConnectionsGoogleBusinessStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/review-connections/facebook-page/start":{"post":{"tags":["integrations"],"summary":"Start Connect with Facebook (Login for Business) for a Facebook Page: answers Meta's dialog URL","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewConnectionsFacebookPageStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/review-connections/instagram/start":{"post":{"tags":["integrations"],"summary":"Start Connect with Facebook (Login for Business) for the Instagram account linked to a Page: answers Meta's dialog URL","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewConnectionsInstagramStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/review-connections/{id}":{"put":{"tags":["integrations"],"summary":"Connect the App Store or Google Play with the tenant's own key; tests it","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdReviewConnectionsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["integrations"],"summary":"Pause or resume a review connection ({ status })","description":"Permission: `integrations.manage`.","operationId":"patchV1TenantsTenantIdReviewConnectionsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect a review provider (its vault secrets go too)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdReviewConnectionsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/review-connections/{id}/test":{"post":{"tags":["integrations"],"summary":"Test the stored review connection again","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewConnectionsIdTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/integrations/reviews/google-business/callback":{"get":{"tags":["integrations"],"summary":"Google returns here after consent; redirects to the app with connected= or failed=","operationId":"getV1IntegrationsReviewsGoogleBusinessCallback","security":[],"responses":{"303":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/integrations/reviews/meta/callback":{"get":{"tags":["integrations"],"summary":"Meta returns here after Login for Business; redirects to the app with connected= or failed=","operationId":"getV1IntegrationsReviewsMetaCallback","security":[],"responses":{"303":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/review-sources":{"get":{"tags":["integrations"],"summary":"Review sources, on or off, with their branch","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdReviewSources","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["integrations"],"summary":"Add a review source from its connection's list, optionally linked to a branch","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewSources","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/review-sources/discover/{id}":{"get":{"tags":["integrations"],"summary":"Sources a review connection can add (locations, apps, packages)","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdReviewSourcesDiscoverId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/review-sources/{sourceId}":{"patch":{"tags":["integrations"],"summary":"Turn a review source on or off, relink its branch or rename it","description":"Permission: `integrations.manage`.","operationId":"patchV1TenantsTenantIdReviewSourcesSourceId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sourceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Remove a review source and its reviews","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdReviewSourcesSourceId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sourceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/meta/data-deletion":{"post":{"tags":["public"],"summary":"Meta data-deletion callback (form-encoded signed_request, HMAC-SHA256 with the app secret, issued within 7 days): disconnects the person's review connections (Page and Instagram reviews) and keyed Messenger / Instagram DM connections (1307) in every organisation, removes their tokens and imported reviews; answers { url, confirmation_code } (400 BAD_SIGNED_REQUEST, 503 TRY_AGAIN)","operationId":"postV1PublicMetaDataDeletion","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/meta/deauthorize":{"post":{"tags":["public"],"summary":"Meta deauthorize callback (form-encoded signed_request): disconnects the person's review connections (Page and Instagram reviews) and keyed Messenger / Instagram DM connections (1307) and removes their tokens (400 BAD_SIGNED_REQUEST, 503 TRY_AGAIN)","operationId":"postV1PublicMetaDeauthorize","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/meta/data-deletion/status":{"get":{"tags":["public"],"summary":"Status of a Meta data-deletion request by its confirmation code (?code=): completed, or 404 unknown; JSON, or a bilingual page for a browser. Never names an organisation or a person","operationId":"getV1PublicMetaDataDeletionStatus","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connectors/hr":{"get":{"tags":["integrations"],"summary":"HR / directory sources for the org-tree sync (Microsoft Entra ID, SCIM, CSV) with their state, last test and last sync","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdConnectorsHr","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connectors/hr/{source}":{"put":{"tags":["integrations"],"summary":"Connect or reconnect an HR source with its own form (Entra ID: the tenant's app registration; SCIM: base URL and key); tests it","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdConnectorsHrSource","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect an HR source (its vault secrets go too)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdConnectorsHrSource","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connectors/hr/{source}/test":{"post":{"tags":["integrations"],"summary":"Test the stored HR source connection again","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdConnectorsHrSourceTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connectors/hr/{source}/sync":{"post":{"tags":["integrations"],"summary":"Sync now: read the source and propose the org-tree change for review (CSV: the uploaded units and members file refs)","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdConnectorsHrSourceSync","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/integrations/reviews/google-business/notifications":{"post":{"tags":["integrations"],"summary":"Google Cloud Pub/Sub push of Business Profile review notifications (Google-signed OIDC token); 404 while off","operationId":"postV1IntegrationsReviewsGoogleBusinessNotifications","security":[],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/saudi-address/status":{"get":{"tags":["saudi-address"],"summary":"SV-22 whether the Saudi Post National Address lookup is live (coming soon: live false)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdSaudiAddressStatus","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/saudi-address/check":{"post":{"tags":["saudi-address"],"summary":"SV-22 check and normalise a Saudi National Address (short address code or full address) and/or a shared location; returns the stored answer shape, printed lines in English and Arabic, or the issues with English and Arabic messages. lookup: true also asks Saudi Post by short address (coming soon: status off). 60 a minute per organisation","description":"Permission: `feedback.read`.","operationId":"postV1TenantsTenantIdSaudiAddressCheck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"address":{"anyOf":[{"type":"object","properties":{"shortAddress":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"buildingNumber":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"street":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"district":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"city":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"additionalNumber":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"unitNumber":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"location":{"anyOf":[{"type":"object","properties":{"lat":{"type":"number"},"lng":{"type":"number"},"source":{"type":"string","enum":["whatsapp","browser","manual"]},"accuracyM":{"type":"number"}},"required":["lat","lng","source"],"additionalProperties":false},{"type":"null"}]},"lang":{"type":"string","enum":["en","ar"]},"lookup":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/support-desk":{"get":{"tags":["support-desk"],"summary":"03-4 whether Help > Contact support works on this server (a ticket in Five Rivers' own Telvory Desk)","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSupportDesk","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"supportDeskStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/support-desk/tickets":{"post":{"tags":["support-desk"],"summary":"03-4 open a support ticket in Five Rivers' Telvory Desk; the server tags it with the tenant id, plan, member and language from the session. 5 opened tickets an hour per member, 30 per organisation (failed tries do not count; 20 tries an hour per member); the same requestId reaches Desk with the same idempotency key; 503 SUPPORT_DESK_OFF when not configured, SUPPORT_DESK_UNAVAILABLE when Desk does not answer","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSupportDeskTickets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"supportTicketBody","response":"supportTicketCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts supportTicketBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/displays":{"get":{"tags":["displays"],"summary":"Wall displays of the organisation (no tokens): panels, rotation, language, status, last seen","description":"Permission: `displays.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdDisplays","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"displayList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["displays"],"summary":"Make a display and pair it with the 6-character code its TV shows (404 DISPLAY_CODE_INVALID); the TV picks up its read-only token on its next poll","description":"Permission: `displays.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdDisplays","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"displayCreateBody","response":"displayItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts displayCreateBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/displays/{displayId}":{"patch":{"tags":["displays"],"summary":"Change what a display shows (label, panels, rotation, language, ticker); its scope stays as made","description":"Permission: `displays.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdDisplaysDisplayId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"displayId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"displayPatchBody","response":"displayItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts displayPatchBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["displays"],"summary":"Revoke a display at once","description":"Permission: `displays.manage`.","operationId":"deleteV1TenantsTenantIdDisplaysDisplayId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"displayId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/displays/{displayId}/pair":{"post":{"tags":["displays"],"summary":"Move a display to the TV showing this code; the old TV stops at once","description":"Permission: `displays.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdDisplaysDisplayIdPair","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"displayId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"displayPairBody","response":"displayItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts displayPairBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/display/pairing":{"post":{"tags":["displays"],"summary":"TV: a new pairing code to show (10 minutes); sets the httpOnly pairing cookie","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1DisplayPairing","security":[],"x-sayvara-contract":{"response":"displayPairingStart"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/display/pairing/poll":{"post":{"tags":["displays"],"summary":"TV: waiting, or paired (sets the httpOnly display cookie once); 410 DISPLAY_PAIRING_EXPIRED","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1DisplayPairingPoll","security":[],"x-sayvara-contract":{"response":"displayPairingPoll"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/display/me":{"get":{"tags":["displays"],"summary":"TV: the display settings (display cookie; rotates the token once a day); 401 DISPLAY_UNAUTHENTICATED","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1DisplayMe","security":[],"x-sayvara-contract":{"response":"displaySelf"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["displays"],"summary":"TV: unpair this screen (its token stops; the display waits for a new code)","operationId":"deleteV1DisplayMe","security":[],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/widgets":{"get":{"tags":["widgets"],"summary":"Website widgets of the organisation: public key, survey, allowed origins, intercept rules, display, status, daily link cap and today's count, and the script tag (null until the final widget host is live: setup.snippet)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWidgets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"widgetSiteList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["widgets"],"summary":"Add a website widget for one survey (a new public key; daily link cap, default 5000)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdWidgets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"widgetCreateBody","response":"widgetSite"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts widgetCreateBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/widgets/{widgetId}":{"patch":{"tags":["widgets"],"summary":"Change a website widget (survey, origins, rules, display, daily link cap) or pause and resume it","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdWidgetsWidgetId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"widgetId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"widgetUpdateBody","response":"widgetSite"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts widgetUpdateBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["widgets"],"summary":"Remove a website widget (the script on the site goes silent)","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdWidgetsWidgetId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"widgetId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/widget/{key}/config":{"get":{"tags":["widgets"],"summary":"The widget script's rules and display for a listed browser Origin only (CORS, Vary: Origin; the list limits abuse, it does not authenticate); 404 for an unknown or paused key or another origin","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1WidgetKeyConfig","security":[],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"widgetConfig"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/widget/{key}/link":{"get":{"tags":["widgets"],"summary":"A fresh 30-minute signed survey link (channel widget) for a listed browser Origin; when the config names a challenge, the Turnstile token goes in the X-Sayvara-Challenge header (403 WIDGET_CHALLENGE_REQUIRED or WIDGET_CHALLENGE_FAILED, 503 WIDGET_CHALLENGE_UNAVAILABLE); 410 survey closed, 429 rate limit (Retry-After) or WIDGET_DAILY_CAP, 503 not set up","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1WidgetKeyLink","security":[],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"widgetLinkQuery","response":"widgetLink"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/derived-variables":{"get":{"tags":["stats"],"summary":"Saved derived variables (recodes, computed indexes, bands) of the organisation","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdDerivedVariables","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Save a derived variable: { code, name: { en, ar }, definition } (recode, index or bands)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdDerivedVariables","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"name":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["en","ar"],"additionalProperties":false},"definition":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"recode"},"source":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"groups":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z0-9_]{1,40}$"},"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["key","en","ar"],"additionalProperties":false},"values":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":128}}},"required":["category","values"],"additionalProperties":false}},"otherwise":{"default":"drop","anyOf":[{"type":"string","enum":["drop","keep"]},{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z0-9_]{1,40}$"},"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["key","en","ar"],"additionalProperties":false}},"required":["category"],"additionalProperties":false}]}},"required":["kind","source","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"index"},"inputs":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"object","properties":{"source":{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"weight":{"default":1,"type":"number","exclusiveMinimum":0,"maximum":100},"min":{"type":"number","minimum":-1000000,"maximum":1000000},"max":{"type":"number","minimum":-1000000,"maximum":1000000},"reverse":{"default":false,"type":"boolean"}},"required":["source","min","max"],"additionalProperties":false}},"minAnswered":{"default":1,"type":"integer","minimum":1,"maximum":10}},"required":["kind","inputs"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bands"},"source":{"anyOf":[{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"bands":{"minItems":2,"maxItems":20,"type":"array","items":{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z0-9_]{1,40}$"},"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["key","en","ar"],"additionalProperties":false},"upTo":{"anyOf":[{"type":"number","minimum":-1000000,"maximum":1000000},{"type":"null"}]}},"required":["category","upTo"],"additionalProperties":false}}},"required":["kind","source","bands"],"additionalProperties":false}]}},"required":["code","name","definition"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/derived-variables/{id}":{"get":{"tags":["stats"],"summary":"One derived variable","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdDerivedVariablesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["stats"],"summary":"Rename a derived variable or change its definition","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdDerivedVariablesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["en","ar"],"additionalProperties":false},"definition":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"recode"},"source":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"groups":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z0-9_]{1,40}$"},"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["key","en","ar"],"additionalProperties":false},"values":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":128}}},"required":["category","values"],"additionalProperties":false}},"otherwise":{"default":"drop","anyOf":[{"type":"string","enum":["drop","keep"]},{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z0-9_]{1,40}$"},"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["key","en","ar"],"additionalProperties":false}},"required":["category"],"additionalProperties":false}]}},"required":["kind","source","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"index"},"inputs":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"object","properties":{"source":{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"weight":{"default":1,"type":"number","exclusiveMinimum":0,"maximum":100},"min":{"type":"number","minimum":-1000000,"maximum":1000000},"max":{"type":"number","minimum":-1000000,"maximum":1000000},"reverse":{"default":false,"type":"boolean"}},"required":["source","min","max"],"additionalProperties":false}},"minAnswered":{"default":1,"type":"integer","minimum":1,"maximum":10}},"required":["kind","inputs"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bands"},"source":{"anyOf":[{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"bands":{"minItems":2,"maxItems":20,"type":"array","items":{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z0-9_]{1,40}$"},"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["key","en","ar"],"additionalProperties":false},"upTo":{"anyOf":[{"type":"number","minimum":-1000000,"maximum":1000000},{"type":"null"}]}},"required":["category","upTo"],"additionalProperties":false}}},"required":["kind","source","bands"],"additionalProperties":false}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["stats"],"summary":"Remove a derived variable (409 while bands read it)","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdDerivedVariablesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/derived-variables/breakdown":{"post":{"tags":["stats"],"summary":"One derived variable over the filtered responses: counts and the metric per category, or the spread of an index","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdDerivedVariablesBreakdown","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"filters":{"default":{"offsetMinutes":0},"type":"object","properties":{"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"offsetMinutes":{"default":0,"type":"integer","minimum":-720,"maximum":840}},"additionalProperties":false},"where":{"default":[],"maxItems":10,"type":"array","items":{"anyOf":[{"type":"object","properties":{"dimension":{"anyOf":[{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"values":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":128}}},"required":["dimension","values"],"additionalProperties":false},{"type":"object","properties":{"number":{"anyOf":[{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"min":{"type":"number","minimum":-1000000,"maximum":1000000},"max":{"type":"number","minimum":-1000000,"maximum":1000000}},"required":["number"],"additionalProperties":false}]}},"variable":{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"},"definition":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"recode"},"source":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"groups":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z0-9_]{1,40}$"},"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["key","en","ar"],"additionalProperties":false},"values":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":128}}},"required":["category","values"],"additionalProperties":false}},"otherwise":{"default":"drop","anyOf":[{"type":"string","enum":["drop","keep"]},{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z0-9_]{1,40}$"},"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["key","en","ar"],"additionalProperties":false}},"required":["category"],"additionalProperties":false}]}},"required":["kind","source","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"index"},"inputs":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"object","properties":{"source":{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"weight":{"default":1,"type":"number","exclusiveMinimum":0,"maximum":100},"min":{"type":"number","minimum":-1000000,"maximum":1000000},"max":{"type":"number","minimum":-1000000,"maximum":1000000},"reverse":{"default":false,"type":"boolean"}},"required":["source","min","max"],"additionalProperties":false}},"minAnswered":{"default":1,"type":"integer","minimum":1,"maximum":10}},"required":["kind","inputs"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bands"},"source":{"anyOf":[{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"bands":{"minItems":2,"maxItems":20,"type":"array","items":{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z0-9_]{1,40}$"},"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["key","en","ar"],"additionalProperties":false},"upTo":{"anyOf":[{"type":"number","minimum":-1000000,"maximum":1000000},{"type":"null"}]}},"required":["category","upTo"],"additionalProperties":false}}},"required":["kind","source","bands"],"additionalProperties":false}]},"metric":{"type":"string","enum":["nps","csat","ces"]},"lang":{"default":"en","type":"string","enum":["en","ar"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/derived-variables/crosstab":{"post":{"tags":["stats"],"summary":"Cross-tab with significance whose rows or columns may be derived variables, with derived filters","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdDerivedVariablesCrosstab","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"filters":{"default":{"offsetMinutes":0},"type":"object","properties":{"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"offsetMinutes":{"default":0,"type":"integer","minimum":-720,"maximum":840}},"additionalProperties":false},"where":{"default":[],"maxItems":10,"type":"array","items":{"anyOf":[{"type":"object","properties":{"dimension":{"anyOf":[{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"values":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":128}}},"required":["dimension","values"],"additionalProperties":false},{"type":"object","properties":{"number":{"anyOf":[{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"min":{"type":"number","minimum":-1000000,"maximum":1000000},"max":{"type":"number","minimum":-1000000,"maximum":1000000}},"required":["number"],"additionalProperties":false}]}},"rows":{"anyOf":[{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"cols":{"anyOf":[{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"confidence":{"default":0.95,"type":"number"},"correction":{"default":"holm","type":"string","enum":["none","bonferroni","holm","bh"]},"lang":{"default":"en","type":"string","enum":["en","ar"]}},"required":["rows","cols"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/derived-variables/export":{"post":{"tags":["stats"],"summary":"The analysts' CSV with one column per chosen derived variable (audited)","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdDerivedVariablesExport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"filters":{"default":{"offsetMinutes":0},"type":"object","properties":{"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"offsetMinutes":{"default":0,"type":"integer","minimum":-720,"maximum":840}},"additionalProperties":false},"where":{"default":[],"maxItems":10,"type":"array","items":{"anyOf":[{"type":"object","properties":{"dimension":{"anyOf":[{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"values":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":128}}},"required":["dimension","values"],"additionalProperties":false},{"type":"object","properties":{"number":{"anyOf":[{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}]},"min":{"type":"number","minimum":-1000000,"maximum":1000000},"max":{"type":"number","minimum":-1000000,"maximum":1000000}},"required":["number"],"additionalProperties":false}]}},"variables":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","pattern":"^derived:[0-9a-f-]{36}$"}},"lang":{"default":"en","type":"string","enum":["en","ar"]}},"required":["variables"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/send-rules":{"get":{"tags":["setup"],"summary":"Send rules: quiet hours, survey send hours (daily, per weekday, Ramadan), prayer pause, fallback order (defaults when never saved)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSendRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sendRulesView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"Replace the send rules (audited)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSendRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"sendRules","response":"sendRulesView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sendRules"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/consent-log":{"get":{"tags":["setup"],"summary":"Consent, opt-out and STOP log, newest first, masked addresses (filters: channel, kind, from, to; cursor paging; organisation-wide members)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdConsentLog","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"consentLogQuery","response":"consentLogPage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/exec-digest":{"get":{"tags":["messaging"],"summary":"My WhatsApp executive digest: subscribed, daily or weekly, day and hour (organisation time), language, verified number, AI headlines allowed","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdExecDigest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"execDigestView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["messaging"],"summary":"Opt myself in or out of the digest and set its schedule; 409 PHONE_NOT_VERIFIED to opt in without a verified WhatsApp number; audited","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdExecDigest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"execDigestPut","response":"execDigestView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts execDigestPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voice-bridge/my-phone":{"get":{"tags":["messaging"],"summary":"Ring my mobile for phone interviews: my choice, whether my mobile is verified in the last 90 days, whether the bridge rings it, and whether I can verify a mobile in the app","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdVoiceBridgeMyPhone","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"bridgePhoneView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["messaging"],"summary":"Turn ringing my own mobile for phone interviews on or off (self only); 409 PHONE_NOT_VERIFIED to turn it on without a mobile verified in the last 90 days; audited","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdVoiceBridgeMyPhone","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"bridgePhonePut","response":"bridgePhoneView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts bridgePhonePut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voice-bridge/my-desk/start":{"post":{"tags":["messaging"],"summary":"Call my desk number once with a six-digit code (self only; number checks, limits and the voice live gates; 422 BRIDGE_DESK_* with the reason); audited with the number masked","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdVoiceBridgeMyDeskStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"bridgeDeskStart","response":"bridgeDeskStarted"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts bridgeDeskStart"}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voice-bridge/my-desk/confirm":{"post":{"tags":["messaging"],"summary":"Confirm the code from the call: my desk number becomes verified and phone interviews ring it (self only; 5 tries; audited)","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdVoiceBridgeMyDeskConfirm","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"bridgeDeskConfirm","response":"bridgeDeskConfirmed"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts bridgeDeskConfirm"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/security":{"get":{"tags":["tenants"],"summary":"Sign-in and security: whether two-step verification is required, whether you may require it, whether your own account has a second factor, and the sign-in rules the API enforces (password length, recent passwords that cannot be reused, breached-password check, sign-in link and session lifetimes)","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdSecurity","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/security/mfa-required":{"put":{"tags":["tenants"],"summary":"Require two-step verification for every member (owners only; it cannot be turned off). 403 OWNER_ONLY; 409 OWN_MFA_FIRST while your own session has not passed two-step verification; audited","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSecurityMfaRequired","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"mfaRequired":{"type":"boolean","const":true}},"required":["mfaRequired"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/security/sign-in-policy":{"put":{"tags":["tenants"],"summary":"The organisation's own sign-in rules, each only stricter than the platform's: session lifetime (1-12 hours) and idle time (5-60 minutes) for this organisation, the minimum password length for its members (12-64), the number of recent passwords a member may not reuse (5-12; platform 5), and whether email sign-in links open it (owners only). 403 OWNER_ONLY; 409 OWN_SESSION_IS_LINK when links are turned off from a link session; audited. Enforced per organisation: 403 TENANT_SESSION_EXPIRED, TENANT_SESSION_IDLE, SIGN_IN_LINK_NOT_ALLOWED, PASSWORD_CHANGE_REQUIRED; new passwords 400 PASSWORD_TOO_SHORT, PASSWORD_REUSED","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSecuritySignInPolicy","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"sessionAbsoluteHours":{"type":"integer","minimum":1,"maximum":12},"sessionIdleMinutes":{"type":"integer","minimum":5,"maximum":60},"passwordMinLength":{"type":"integer","minimum":12,"maximum":64},"emailLinksAllowed":{"type":"boolean"},"passwordHistory":{"anyOf":[{"type":"integer","minimum":5,"maximum":12},{"type":"null"}]}},"required":["sessionAbsoluteHours","sessionIdleMinutes","passwordMinLength","emailLinksAllowed"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/security/sso-enforcement":{"get":{"tags":["tenants"],"summary":"Single sign-on enforcement: whether SSO is required, whether an SSO connection is active and someone has signed in through it, the break-glass owner accounts (one or two: still an owner, authenticator app on), how your own session signed in, the last 10 break-glass uses with how the owners were told (emailed, partly, or not sent), the uses no owner has acknowledged yet, and the owners and admins who cannot open the organisation while it is on (or would lose access if it were turned on now)","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdSecuritySsoEnforcement","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["tenants"],"summary":"Require single sign-on (or stop requiring it). Owners only, with a second factor passed in the last 10 minutes (403 RECENT_SIGN_IN_REQUIRED). While on, password, sign-in link and invite sessions are refused (403 SSO_REQUIRED; at sign-in too when every organisation of the person requires it) except the break-glass owners signed in with password and authenticator app (else 403 BREAK_GLASS_TOTP_REQUIRED), whose first request per session is recorded and emailed to every owner. Turning it on ends the open password sessions of members of no other organisation (endedSessions; Activity tenant.sso_required.sessions_ended). Owners and admins who would lose access must each be named in acceptLockout, else 409 SSO_REQUIRED_LOCKS_OUT with the list (ids, names, roles). 409 SSO_NOT_CONNECTED, SSO_NOT_VERIFIED (nobody has signed in through it yet), SSO_NOT_ENTITLED (without single sign-on in the plan, only an Entra connection counts), BREAK_GLASS_NOT_OWNER, BREAK_GLASS_NO_TOTP, SSO_LOCKOUT, OWN_TOTP_FIRST, OWN_MFA_FIRST. While on, connection, Entra directory and verified-domain changes answer 409 SSO_REQUIRED_STOP_FIRST; audited","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSecuritySsoEnforcement","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"ssoRequired":{"type":"boolean"},"acceptLockout":{"maxItems":1000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["ssoRequired"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/security/sso-enforcement/break-glass":{"put":{"tags":["tenants"],"summary":"Make your own account a break-glass account (slot 1 or 2, else the first free one; owners only, authenticator app on, second factor in the last 10 minutes). 403 OWNER_ONLY, RECENT_SIGN_IN_REQUIRED; 409 OWN_TOTP_FIRST, BREAK_GLASS_SLOT_TAKEN, BREAK_GLASS_WHILE_REQUIRED (slot 1 while single sign-on is required); audited","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdSecuritySsoEnforcementBreakGlass","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"slot":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/security/sso-enforcement/break-glass/{userId}":{"delete":{"tags":["tenants"],"summary":"Remove a break-glass account (owners only, second factor in the last 10 minutes); slot 2 moves up when slot 1 goes. 404 NOT_FOUND when it is not one; 409 BREAK_GLASS_LAST_ONE while single sign-on is required and it is the only one; audited","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdSecuritySsoEnforcementBreakGlassUserId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"userId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/security/sso-enforcement/break-glass/uses/ack":{"post":{"tags":["tenants"],"summary":"Acknowledge break-glass uses (the listed ids, or all not yet acknowledged): they leave the not-acknowledged list for every owner. Owners only, second factor in the last 10 minutes; audited (tenant.break_glass.acknowledged)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdSecuritySsoEnforcementBreakGlassUsesAck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"ids":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/sessions":{"get":{"tags":["auth"],"summary":"Your own live sessions (this one first): when each was opened and last used, browser and system, IP address, and which is this one. Never another account's","operationId":"getV1AuthSessions","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/sessions/sign-out-others":{"post":{"tags":["auth"],"summary":"Sign out everywhere else: ends every other session of this account (this one stays), answers how many ended, and removes a Nafath link (emailed). 403 IDP_SESSION_NOT_ALLOWED from an identity-provider session; 429 over 10 a quarter hour; audited","operationId":"postV1AuthSessionsSignOutOthers","security":[{"session":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/security/overview":{"get":{"tags":["tenants"],"summary":"Security overview, read-only: two-step verification and single sign-on rules, SSO connection kinds and status, break-glass account count, the password and session rules in force, IP allowlist size, roles with masked fields, the customer-managed key state, whether the organisation has its own data key, the audit chain head and last verification, SIEM sinks (kind, on or off, last delivery), the data region and the deployment. Never a secret, issuer or client id. Members with access to the whole organisation only (403 OVERVIEW_TENANT_WIDE_ONLY for a branch-scoped member). The demo guest reads it redacted","description":"Permission: `audit.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSecurityOverview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"securityOverview"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/demo-reports":{"get":{"tags":["reports"],"summary":"The demo reports this organisation has: [{ id: \"mawani\", from, to }] for the Mawani demo, else an empty list (the web app shows its menu entry from it)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdDemoReports","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/demo-reports/mawani":{"get":{"tags":["reports"],"summary":"Mawani demo: Q3 satisfaction per service, the simple mean of the 13 services, the sample calculator (achieved yes/no), the reasons per service (negative for 1-3, positive for 4-5), breakdowns by job type, port, age and gender, the NPS and a few open comments, from the stored answers of the quarterly survey between two Riyadh days; 404 MAWANI_REPORT_NONE for any other organisation","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdDemoReportsMawani","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"default":"2026-07-01","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"default":"2026-10-07","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/demo-reports/mawani/drill":{"get":{"tags":["reports"],"summary":"Mawani demo: the stored answers behind one figure of the report (filters by service, rating label, reason, NPS bucket or score, job type, port, age, gender, comment), newest first and paged; total equals the figure; comments with phone numbers and e-mail addresses masked; 400 MAWANI_DRILL_BAD_FILTER for an unknown id","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdDemoReportsMawaniDrill","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"mawaniDrillQuery","response":"mawaniDrillPage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/demo-reports/mawani/adaa.xlsx":{"get":{"tags":["reports"],"summary":"Mawani demo: the Adaa workbook (\"Survey Responses Q3 (MAWANI).xlsx\"): one row per stored Survey A response in the 373 columns of the workbook, the sample calculator, and the per-service counts and rating tables at the cell addresses of the workbook with their formulas; contact details masked by role; 404 MAWANI_REPORT_NONE for any other organisation","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdDemoReportsMawaniAdaaXlsx","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"default":"2026-07-01","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"default":"2026-10-07","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-centre/settings":{"get":{"tags":["reports"],"summary":"The organisation's fiscal year start (1-12) and report time zone; the defaults (January, Asia/Riyadh) while none are saved","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportCentreSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"reportSettingsView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["reports"],"summary":"Save the fiscal year start and the report time zone (an IANA zone); 400 VALIDATION_FAILED otherwise; audited","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdReportCentreSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"reportSettingsPut","response":"reportSettingsView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts reportSettingsPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-centre/runs":{"post":{"tags":["reports"],"summary":"Ask for a run of a catalogue report type for a period, scope (always narrowed to your units), sections, formats and languages; 200 with repeat when the same request already has a live or ready run; 400 REPORT_*/PERIOD_INVALID, 403 REPORT_TYPE_FORBIDDEN, 404, 429, 503; audited","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdReportCentreRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"reportCentreRunCreate","response":"reportCentreRunAccepted"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts reportCentreRunCreate"}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["reports"],"summary":"The run history you may see (your units, the types you may make; others' runs with feedback.export), newest first, paged","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportCentreRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"reportCentreRunListQuery","response":"reportCentreRunList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-centre/runs/preview":{"post":{"tags":["reports"],"summary":"Before a run: the same body as POST runs, checked the same way (the same refusals), answered with the number of answers the run would count in its period, scope and survey and whether that base is under the minimum of the type (small); unknown for a type whose base is not counted before the run (a type whose run flags no small base, such as quota progress, is unknown). Read-only: no run, no job, no audit entry (refusals are deliberately not audited either; POST runs is); counts only; 429 when asked too often by the member or the tenant","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdReportCentreRunsPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"reportCentreRunCreate","response":"reportCentreRunPreview"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts reportCentreRunCreate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-centre/runs/{id}":{"get":{"tags":["reports"],"summary":"One run; 404 when unknown or outside your reach","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportCentreRunsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"reportCentreRun"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-centre/runs/{id}/file":{"get":{"tags":["reports"],"summary":"Download one file of a run: a redirect to a 5-minute link (409 RUN_NOT_READY while it is being made); audited","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportCentreRunsIdFile","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"reportCentreRunFileQuery"},"responses":{"302":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-centre/catalogue":{"get":{"tags":["reports"],"summary":"The catalogue report types you may make and the formats of each, by the rules of POST runs (permissions with your custom role, flags, each format's permission and plan, whole-organisation sources, contact masks)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportCentreCatalogue","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"reportCentreCatalogue"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-centre/templates":{"post":{"tags":["reports"],"summary":"Save a report template (a type or a dashboard with pages, a period rule, compare, scope narrowed to your units, sections, formats, languages; private or shared); the same checks as a run; 400 REPORT_*/PERIOD_INVALID, 403, 404, 409 REPORT_TEMPLATE_MEMBER_LIMIT (50 per member) or REPORT_TEMPLATE_LIMIT (500 per organisation), 429; audited","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdReportCentreTemplates","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"reportTemplateCreate","response":"reportTemplateView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts reportTemplateCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["reports"],"summary":"Your templates and the shared ones you may use (types you may make, units inside your scope), newest first, paged; 429","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportCentreTemplates","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"reportTemplateListQuery","response":"reportTemplateList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-centre/templates/{id}":{"get":{"tags":["reports"],"summary":"One template; 404 when unknown or outside your reach; 429","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportCentreTemplatesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"reportTemplateView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["reports"],"summary":"Replace your template, checked as on save; 403 REPORT_TEMPLATE_NOT_OWNER for another member's; 429; audited","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdReportCentreTemplatesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"reportTemplateUpdate","response":"reportTemplateView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts reportTemplateUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["reports"],"summary":"Delete your template, or with members.write any template of the organisation within your units; 403 REPORT_TEMPLATE_NOT_OWNER for another member's without it; 429; audited","description":"Permission: `dashboards.read`.","operationId":"deleteV1TenantsTenantIdReportCentreTemplatesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-centre/templates/{id}/run":{"post":{"tags":["reports"],"summary":"Run the template now through the run API (period resolved today, units narrowed to yours); 200 with repeat for the same live run; 429; audited","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdReportCentreTemplatesIdRun","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"reportCentreRunAccepted"},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/media-answers/status":{"get":{"tags":["media-answers"],"summary":"Gap X8: whether audio and video answers are transcribed for this organisation (speech engine configured and the survey.media_answers switch on)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdMediaAnswersStatus","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/media-answers/{responseId}/{fileId}":{"get":{"tags":["media-answers"],"summary":"Gap X8: the stored transcript (Arabic / English), language, confidence, themes and sentiment of one audio or video answer; status none before the first run, off while the feature is off","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdMediaAnswersResponseIdFileId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"responseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"fileId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["media-answers"],"summary":"Gap X8: transcribe one audio or video answer now and tag its themes and sentiment (idempotent: a finished answer is returned as stored; 300 runs an hour per organisation)","description":"Permission: `feedback.read`.","operationId":"postV1TenantsTenantIdMediaAnswersResponseIdFileId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"responseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"fileId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/config":{"get":{"tags":["live-demo"],"summary":"Live demo settings for the public page: on or off, Turnstile site key, accepted countries, channels offered, code length","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1PublicLiveDemoConfig","security":[],"x-sayvara-contract":{"response":"LiveDemoConfigDto"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions":{"post":{"tags":["live-demo"],"summary":"Start a live demo (scenario, language, WhatsApp or web) after Cloudflare Turnstile; 3 per network per hour (LIVE_DEMO_IP_LIMIT); 503 LIVE_DEMO_OFF / LIVE_DEMO_WHATSAPP_OFF","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1PublicLiveDemoSessions","security":[],"x-sayvara-contract":{"body":"liveDemoCreate","response":"LiveDemoCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts liveDemoCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}":{"get":{"tags":["live-demo"],"summary":"The session and every timeline step so far (page reload)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1PublicLiveDemoSessionsId","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"LiveDemoSessionDto"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}/verify":{"post":{"tags":["live-demo"],"summary":"WhatsApp demo: send a 6-digit code by SMS (Twilio Verify) to a Saudi or GCC mobile; 3 sessions per number per 24 hours, a daily cap for everyone, STOP honoured","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1PublicLiveDemoSessionsIdVerify","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"liveDemoVerifyStart"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts liveDemoVerifyStart"}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}/verify/check":{"post":{"tags":["live-demo"],"summary":"Check the code (5 tries); the number then lives only on the demo contact and is deleted within 24 hours","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1PublicLiveDemoSessionsIdVerifyCheck","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"liveDemoVerifyCheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts liveDemoVerifyCheck"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}/send":{"post":{"tags":["live-demo"],"summary":"Send the survey: the approved WhatsApp template (202) or, on the web channel, a 30-minute signed survey link for the page (200 with surveyUrl)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1PublicLiveDemoSessionsIdSend","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"liveDemoEmpty"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts liveDemoEmpty"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}/resolve":{"post":{"tags":["live-demo"],"summary":"Play the manager: resolve the demo ticket; on WhatsApp the product's \"Did we fix it?\" re-survey follows","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1PublicLiveDemoSessionsIdResolve","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"liveDemoEmpty"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts liveDemoEmpty"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}/recheck":{"post":{"tags":["live-demo"],"summary":"Answer \"Did we fix it?\" in the page (web channel, or when the WhatsApp re-survey could not be sent); closes the loop","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1PublicLiveDemoSessionsIdRecheck","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"liveDemoRecheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts liveDemoRecheck"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}/manager-alert":{"post":{"tags":["live-demo"],"summary":"Catch up the timeline (the manager alert to the prospect's WhatsApp goes by itself when the ticket opens)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1PublicLiveDemoSessionsIdManagerAlert","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"liveDemoEmpty"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts liveDemoEmpty"}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}/guest-link":{"post":{"tags":["live-demo"],"summary":"One-click \"See it in the full product\": a 120-second, single-use link (GET /v1/auth/demo-enter, which lands on the demo app /demo-enter page) where the visitor presses \"Open the demo\" to sign in as the guest login of the demo organisation and open the ticket or answer of this session (after the answer; 3 per session; never for a non-demo organisation)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1PublicLiveDemoSessionsIdGuestLink","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"liveDemoEmpty","response":"LiveDemoGuestLink"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts liveDemoEmpty"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/demo-enter":{"get":{"tags":["live-demo"],"summary":"Guest link landing (browser navigation): never sets a cookie and never uses the link; redirects to the demo app /demo-enter page with the link in the fragment","operationId":"getV1AuthDemoEnter","security":[],"responses":{"302":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["live-demo"],"summary":"Use a live demo guest link from the demo app page ({ t }): only with the app Origin and a same-site Sec-Fetch-Site (403 FORBIDDEN_ORIGIN); 409 DEMO_ENTER_SIGNED_IN when a non-demo login is signed in; sets the 2-hour guest session cookie and answers { target }; 400 INVALID_LINK for a bad, used or expired link","operationId":"postV1AuthDemoEnter","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}/steps":{"get":{"tags":["live-demo"],"summary":"Timeline steps after `after` (long-poll up to 20 s): the fallback when Server-Sent Events are blocked","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1PublicLiveDemoSessionsIdSteps","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"LiveDemoStepsPage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/live-demo/sessions/{id}/stream":{"get":{"tags":["live-demo"],"summary":"Live timeline (text/event-stream): `step` events with id = seq (replays all, or after Last-Event-ID), ping every 20 s, ends after 10 minutes or when the loop closes","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1PublicLiveDemoSessionsIdStream","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"LiveDemoStep"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/assignments":{"get":{"tags":["field"],"summary":"Field assignments with each one's visits done, cap counted and over cap (maxCompletes, capCounted, overCap: only while field.capi is on too), located and with a photo, and the phone's last sync","description":"Permission: `field.manage`.","operationId":"getV1TenantsTenantIdFieldAssignments","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","required":false,"schema":{"default":"current","type":"string","enum":["current","all"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["field"],"summary":"Give a member a field assignment: a survey, a target number of visits, an optional branch and due date, or a visit day at a venue with a tablet, and an optional maxCompletes (only while field.capi is on too, else 400 VALIDATION_FAILED as an unknown field; the most completed phone interviews counted for the collector, at least the target: 422 FIELD_CAP_BELOW_TARGET; screen-outs and tablet answers are not capped) (the bulk route's 403, 422 and 409 codes)","description":"Permission: `field.manage`.","operationId":"postV1TenantsTenantIdFieldAssignments","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":80},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentUserId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"target":{"type":"integer","minimum":1,"maximum":10000},"dueOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"maxCompletes":{"anyOf":[{"type":"integer","minimum":1,"maximum":10000},{"type":"null"}]},"visitOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"kioskId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"deliveryTargetId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["label","surveyId","agentUserId","target"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/assignments/{assignmentId}":{"patch":{"tags":["field"],"summary":"Rename, retarget, set or clear maxCompletes (only while field.capi is on too, else 400 as an unknown field; a target above a cap kept from then raises the cap to the target; null = no cap; at least the target: 422 FIELD_CAP_BELOW_TARGET; already synced visits keep their marks, so never below the completes already counted: 422 FIELD_CAP_BELOW_COUNTED), move the due date or visit day (the venue rules of the bulk route), close or reopen an assignment (a reviewed visit's day, tablet, target and status no longer change: 409 FIELD_VISIT_REVIEWED; never move your own visit or change your own cap: 403 FIELD_EDIT_OWN_VISIT)","description":"Permission: `field.manage`.","operationId":"patchV1TenantsTenantIdFieldAssignmentsAssignmentId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":80},"target":{"type":"integer","minimum":1,"maximum":10000},"dueOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"status":{"type":"string","enum":["active","closed"]},"maxCompletes":{"anyOf":[{"type":"integer","minimum":1,"maximum":10000},{"type":"null"}]},"visitOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"kioskId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"deliveryTargetId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/assignments/bulk":{"post":{"tags":["field"],"summary":"Book a day of visits at a venue: one visit per collector, each with an optional tablet, all with an optional maxCompletes (only while field.capi is on too, else 400 as an unknown field; a branch-scoped caller books only in their branches: 403 FIELD_UNIT_OUT_OF_SCOPE, and only collectors who work tenant-wide or in one of their branches, as assign-options offers: 403 FIELD_AGENT_OUT_OF_SCOPE; 422 FIELD_AGENT_INVALID, FIELD_SURVEY_INVALID, FIELD_CAP_BELOW_TARGET, FIELD_VENUE_INVALID, FIELD_VENUE_CLOSED, FIELD_KIOSK_INVALID; 409 FIELD_VISIT_EXISTS, FIELD_KIOSK_BOOKED)","description":"Permission: `field.manage`.","operationId":"postV1TenantsTenantIdFieldAssignmentsBulk","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":80},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"visitOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"agentUserIds":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"target":{"type":"integer","minimum":1,"maximum":10000},"deliveryTargetId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kioskIds":{"type":"object","propertyNames":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"additionalProperties":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"maxCompletes":{"anyOf":[{"type":"integer","minimum":1,"maximum":10000},{"type":"null"}]}},"required":["label","surveyId","orgUnitId","visitOn","agentUserIds","target"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/assignments/{assignmentId}/start":{"post":{"tags":["field"],"summary":"Start a visit: its tablet is pointed at the venue and survey (the collector or a supervisor; only a live visit on its Riyadh day: 409 FIELD_VISIT_CLOSED, FIELD_VISIT_NOT_TODAY; 409 FIELD_KIOSK_PENDING while the tablet holds unsent answers from another venue)","description":"Permission: `tenant.read`.","operationId":"postV1TenantsTenantIdFieldAssignmentsAssignmentIdStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/assignments/{assignmentId}/finish":{"post":{"tags":["field"],"summary":"The collector finishes a visit (idempotent; a plain assignment with no visit day: 409 FIELD_NOT_A_VISIT)","description":"Permission: `tenant.read`.","operationId":"postV1TenantsTenantIdFieldAssignmentsAssignmentIdFinish","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/assignments/{assignmentId}/review":{"post":{"tags":["field"],"summary":"Accept or reject a visit, once (a rejection says why; never your own visit: 403 FIELD_REVIEW_OWN_VISIT; 409 FIELD_ALREADY_REVIEWED; a plain assignment with no visit day: 409 FIELD_NOT_A_VISIT; accept only a finished visit on or after its Riyadh day: 409 FIELD_VISIT_NOT_FINISHED, FIELD_VISIT_NOT_DUE)","description":"Permission: `field.manage`.","operationId":"postV1TenantsTenantIdFieldAssignmentsAssignmentIdReview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"status":{"type":"string","enum":["accepted","rejected"]},"note":{"type":"string","minLength":1,"maxLength":500}},"required":["status"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/assignments/{assignmentId}/report":{"get":{"tags":["field"],"summary":"A visit's report: interviews, average NPS, CSAT and CES, the latest comments (masked for the reader), quality checks; only while field.capi is on for the tenant, also the visit's cap fields (MOS CAPI P5), the interviews by mode (modes: interviewer, self, unrecorded = phone visits saved with no mode, tablet) and the saved phone visits with mode (null when none), durationS, respondentConsent and overCap (the list has every saved phone visit, newest first, at most 200, over-cap ones included and marked overCap: true; modes and interviews leave those out; cap fields, modes and phone visits are left out entirely while it is off), and MOS CAPI P4's collector quality and this visit's QC score (null while it is off)","description":"Permission: `field.manage`.","operationId":"getV1TenantsTenantIdFieldAssignmentsAssignmentIdReport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"assignmentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/visits/{visitId}/qc":{"put":{"tags":["field"],"summary":"Score a finished visit 0-100 with an optional note; {visitId} is the visit's assignment id (never your own visit: 403 FIELD_REVIEW_OWN_VISIT; a plain assignment: 409 FIELD_NOT_A_VISIT; still active: 409 FIELD_VISIT_NOT_FINISHED; the audit row carries the score, never the note)","description":"Permission: `field.manage`.","operationId":"putV1TenantsTenantIdFieldVisitsVisitIdQc","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100},"note":{"type":"string","maxLength":500}},"required":["score"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/visits/{visitId}/back-check":{"put":{"tags":["field"],"summary":"Record, once, the supervisor back-check of an accepted visit drawn at acceptance: confirmed, not verifiable or failed, by an on-site re-visit or a review of the visit record (no call-back: no respondent contact is held; the rate is set by the server; 409 FIELD_VISIT_NOT_ACCEPTED, FIELD_NOT_IN_BACK_CHECK, FIELD_BACK_CHECK_DONE, FIELD_QC_BUSY; never your own visit: 403 FIELD_REVIEW_OWN_VISIT)","description":"Permission: `field.manage`.","operationId":"putV1TenantsTenantIdFieldVisitsVisitIdBackCheck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"result":{"type":"string","enum":["confirmed","not_verifiable","failed"]},"method":{"type":"string","enum":["revisit","record_review"]}},"required":["result","method"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/back-checks":{"get":{"tags":["field"],"summary":"The week's back-check sample: the accepted visits of the ISO week (default: the current Riyadh week) that a keyed, server-side coin drew at acceptance (each with a 10 % chance), in the caller's branches; a read only, visit facts only","description":"Permission: `field.manage`.","operationId":"getV1TenantsTenantIdFieldBackChecks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"week","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/assign-options":{"get":{"tags":["field"],"summary":"The pickers of the Assign collectors dialog: active collectors who work tenant-wide or in at least one of the caller's branches (caller or agent role; user id and name only, never a phone or email), surveys that are not archived, and active tablets in the caller's scope","description":"Permission: `field.manage`.","operationId":"getV1TenantsTenantIdFieldAssignOptions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/progress":{"get":{"tags":["field"],"summary":"Supervisor progress: per agent, target, visits done, today, located, photos, answers waiting on the phone, last sync","description":"Permission: `field.manage`.","operationId":"getV1TenantsTenantIdFieldProgress","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/visits/{responseId}/photo":{"get":{"tags":["field"],"summary":"A 5-minute link to a visit's photo","description":"Permission: `field.manage`.","operationId":"getV1TenantsTenantIdFieldVisitsResponseIdPhoto","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"responseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["field"],"summary":"The photo of a saved visit with photo consent (JPEG, PNG or WebP, up to 5 MB; a resend keeps the first)","description":"Permission: `tenant.read`.","operationId":"putV1TenantsTenantIdFieldVisitsResponseIdPhoto","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"responseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/status":{"get":{"tags":["field"],"summary":"Whether the field screens are on for this organisation, and whether this member supervises (field.manage) or collects (an active assignment), capi (field.capi is on too: the per-interviewer cap exists and the report splits interviews by mode) and capiFields (sync takes mode and respondentConsent; true whenever on); never 404","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdFieldStatus","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/me":{"get":{"tags":["field"],"summary":"The agent's active assignments with each survey's live version, to run offline (?pending=N: answers waiting on the phone; maxCompletes and capCounted only while field.capi is on)","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdFieldMe","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"pending","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":100000}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/sync":{"post":{"tags":["field"],"summary":"Upload up to 25 finished visits (idempotent per response id; a resend changes nothing stored): saved, rejected or retry per visit; a saved visit may carry FIELD_OVER_CAP: stored, not counted (past the assignment's maxCompletes, only while field.capi is on; a screened-out visit never is); GPS only with consent; optional mode interviewer (CAPI) or self (the respondent's own answer); a visit without a mode is interviewer while field.capi is on and is stored with no mode while it is off; an interviewer visit without respondentConsent true is that visit rejected with code FIELD_CONSENT_REQUIRED (the rest of the batch goes on); the server keeps the time of the consent on its own clock and computes the duration from startedAt and submittedAt","description":"Permission: `tenant.read`.","operationId":"postV1TenantsTenantIdFieldSync","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"items":{"minItems":1,"maxItems":25,"type":"array","items":{"type":"object","properties":{"responseId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"assignmentId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"surveyVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"lang":{"type":"string","enum":["ar","en"]},"answers":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":200},"additionalProperties":{}},"passed":{"maxItems":500,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"startedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"submittedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"location":{"type":"object","properties":{"consent":{"type":"boolean","const":true},"lat":{"type":"number","minimum":-90,"maximum":90},"lng":{"type":"number","minimum":-180,"maximum":180},"accuracyM":{"type":"number","minimum":0,"maximum":100000}},"required":["consent","lat","lng"],"additionalProperties":false},"photoConsent":{"default":false,"type":"boolean"},"mode":{"type":"string","enum":["interviewer","self"]},"respondentConsent":{"default":false,"type":"boolean"}},"required":["responseId","assignmentId","surveyId","surveyVersion","lang","answers","passed","startedAt","submittedAt"],"additionalProperties":false}},"pending":{"type":"integer","minimum":0,"maximum":100000}},"required":["items"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/social-handles":{"get":{"tags":["contacts"],"summary":"A customer's public social handles (X, Instagram, Facebook, TikTok) and how many mentions each links to their timeline","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdSocialHandles","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","in":"query","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["contacts"],"summary":"Add a handle to a customer (organisation-wide members): links that author's earlier and future mentions on the network; 409 when another customer has it","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdSocialHandles","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"network":{"type":"string","enum":["x","instagram","facebook","tiktok"]},"handle":{"type":"string","maxLength":80}},"required":["contactId","network","handle"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/social-handles/{network}/{handle}":{"delete":{"tags":["contacts"],"summary":"Remove a customer's handle and the mention links it made","description":"Permission: `contacts.write`.","operationId":"deleteV1TenantsTenantIdSocialHandlesNetworkHandle","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"network","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"handle","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","in":"query","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-actions":{"get":{"tags":["feedback"],"summary":"One survey's actions (?surveyId=): when a score band or an answer matches, then ticket, alert, email, WhatsApp, webhook or tag","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveyActions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyActionList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["feedback"],"summary":"Add an action to a survey (off unless enabled; at most 20 per survey, 409 ACTION_LIMIT)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveyActions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyActionCreate","response":"surveyActionItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyActionCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-actions/runs":{"get":{"tags":["feedback"],"summary":"The workflow log (?surveyId=, optional actionId and before): each run of an action with every step's outcome, newest first","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveyActionsRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyActionRunList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-actions/{actionId}":{"patch":{"tags":["feedback"],"summary":"Change an action; switching it on runs it only on answers completed from then on","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdSurveyActionsActionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"actionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyActionPatch","response":"surveyActionItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyActionPatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["feedback"],"summary":"Delete an action (its runs stay in the workflow log)","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdSurveyActionsActionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"actionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/campaigns/availability":{"get":{"tags":["campaigns"],"summary":"Whether bulk campaigns are on for this organisation","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdCampaignsAvailability","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/campaigns/audiences":{"get":{"tags":["campaigns"],"summary":"Saved audience filters (contact attributes only, never a list of people)","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdCampaignsAudiences","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["campaigns"],"summary":"Save an audience filter (at most 200 per organisation; 422 CAMPAIGN_AUDIENCE_TOO_LONG past 4,000 characters stored)","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdCampaignsAudiences","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"filter":{"type":"object","properties":{"orgUnitIds":{"maxItems":80,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"lang":{"type":"string","enum":["ar","en"]},"city":{"type":"string","minLength":1,"maxLength":64},"notSurveyedDays":{"type":"integer","minimum":1,"maximum":730},"createdAfter":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"search":{"type":"string","minLength":1,"maxLength":100}},"additionalProperties":false}},"required":["name","filter"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/campaigns/audiences/{audienceId}":{"delete":{"tags":["campaigns"],"summary":"Delete a saved audience filter","description":"Permission: `contacts.write`.","operationId":"deleteV1TenantsTenantIdCampaignsAudiencesAudienceId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"audienceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/campaigns":{"get":{"tags":["campaigns"],"summary":"Campaigns of the organisation, newest first, a page at a time (`limit`, 200 by default and at most, `cursor` = the `nextCursor` of the page before); a branch-scoped member sees only the campaigns they made","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdCampaigns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"default":200,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["campaigns"],"summary":"Make a campaign (status pending_approval with an `approvalId` when the organisation needs approval for mass sends; the worker never sends it until approved): a live survey, an audience (contacts, segment, saved filter or CSV), a channel order, now or a planned time, a daily cap and up to 2 reminders; the same idempotency key with the same body answers that campaign with `replayed: true` (422 IDEMPOTENCY_KEY_REUSED with another body); 404 SURVEY_NOT_FOUND, 409 SURVEY_NOT_LIVE, 422 CAMPAIGN_AUDIENCE_TOO_LONG (the audience past 4,000 characters stored)","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdCampaigns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"audience":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"contacts"},"contactIds":{"minItems":1,"maxItems":50000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["kind","contactIds"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"segment"},"filter":{"type":"object","properties":{"orgUnitIds":{"maxItems":80,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"lang":{"type":"string","enum":["ar","en"]},"city":{"type":"string","minLength":1,"maxLength":64},"notSurveyedDays":{"type":"integer","minimum":1,"maximum":730},"createdAfter":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"search":{"type":"string","minLength":1,"maxLength":100}},"additionalProperties":false}},"required":["kind","filter"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"saved"},"audienceId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kind","audienceId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"csv"},"csv":{"type":"string","minLength":1},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"defaultCountry":{"default":"SA","type":"string","enum":["SA","AE","KW","BH","QA","OM"]}},"required":["kind","csv"],"additionalProperties":false}]},"channels":{"default":["whatsapp","sms","email"],"minItems":1,"maxItems":3,"type":"array","items":{"type":"string","enum":["whatsapp","sms","email"]}},"subjectKind":{"default":"visit","type":"string","enum":["call","visit","order","ticket"]},"lang":{"default":null,"anyOf":[{"type":"string","enum":["ar","en"]},{"type":"null"}]},"startAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"dailyCap":{"default":null,"anyOf":[{"type":"integer","minimum":1,"maximum":100000},{"type":"null"}]},"batchSize":{"default":500,"type":"integer","minimum":10,"maximum":2000},"reminders":{"default":0,"type":"integer","minimum":0,"maximum":2},"reminderAfterHours":{"default":48,"type":"integer","minimum":24,"maximum":168},"idempotencyKey":{"type":"string","minLength":8,"maxLength":100}},"required":["name","surveyId","audience"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/campaigns/preview":{"post":{"tags":["campaigns"],"summary":"How many people an audience (contacts, segment or saved filter) reaches now","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdCampaignsPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"audience":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"contacts"},"contactIds":{"minItems":1,"maxItems":50000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["kind","contactIds"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"segment"},"filter":{"type":"object","properties":{"orgUnitIds":{"maxItems":80,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"lang":{"type":"string","enum":["ar","en"]},"city":{"type":"string","minLength":1,"maxLength":64},"notSurveyedDays":{"type":"integer","minimum":1,"maximum":730},"createdAfter":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"search":{"type":"string","minLength":1,"maxLength":100}},"additionalProperties":false}},"required":["kind","filter"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"saved"},"audienceId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kind","audienceId"],"additionalProperties":false}]}},"required":["audience"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/campaigns/{campaignId}":{"get":{"tags":["campaigns"],"summary":"A campaign with its health: queued, sent, delivered, opened, responded, failed and skipped with reasons","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdCampaignsCampaignId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/campaigns/{campaignId}/pause":{"post":{"tags":["campaigns"],"summary":"Pause a planned or running campaign (what still waits is held back; 409 CAMPAIGN_STATE otherwise); answers `{ campaign }`","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdCampaignsCampaignIdPause","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/campaigns/{campaignId}/resume":{"post":{"tags":["campaigns"],"summary":"Resume a paused campaign (held people get a new invitation, each sent once); answers `{ campaign }`","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdCampaignsCampaignIdResume","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/campaigns/{campaignId}/cancel":{"post":{"tags":["campaigns"],"summary":"Cancel a campaign: nobody else is sent to, waiting invitations are held back; answers `{ campaign }`","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdCampaignsCampaignIdCancel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/profile":{"get":{"tags":["billing"],"summary":"Billing profile and the tax treatment it gives (404 BILLING_PROFILE_MISSING before the first save)","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingProfile","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"billingProfile"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["billing"],"summary":"Save the billing profile; the country is required before the first payment and locked after the first invoice","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdBillingProfile","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"billingProfileBody","response":"billingProfile"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts billingProfileBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/invoices":{"get":{"tags":["billing"],"summary":"Invoices and notes, newest first (page with before)","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingInvoices","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"invoiceList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/invoices/{invoiceId}":{"get":{"tags":["billing"],"summary":"One invoice with lines and the ZATCA QR payload","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingInvoicesInvoiceId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"invoiceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"invoiceDetail"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/invoices/{invoiceId}/document":{"get":{"tags":["billing"],"summary":"The bilingual (Arabic and English) invoice document: PDF once archived, print page until then","description":"Permission: `billing.manage`.","operationId":"getV1TenantsTenantIdBillingInvoicesInvoiceIdDocument","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"invoiceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/invoices/{invoiceId}/pay":{"post":{"tags":["billing"],"summary":"Start paying an invoice with the hosted Moyasar form (card, mada, Apple Pay, STC Pay)","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingInvoicesInvoiceIdPay","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"invoiceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"payBody","response":"paymentIntent"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts payBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/payments/confirm":{"post":{"tags":["billing"],"summary":"After the hosted form returns: re-fetch the payment from Moyasar and book it","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingPaymentsConfirm","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"confirmPaymentBody","response":"paymentConfirmation"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts confirmPaymentBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/payment-methods":{"get":{"tags":["billing"],"summary":"Saved cards (brand, last four digits, expiry only)","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingPaymentMethods","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"paymentMethodList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["billing"],"summary":"Save a card tokenised by the hosted form","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingPaymentMethods","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"paymentMethodBody","response":"paymentMethodItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts paymentMethodBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/payment-methods/{methodId}":{"delete":{"tags":["billing"],"summary":"Remove a saved card","description":"Permission: `billing.manage`.","operationId":"deleteV1TenantsTenantIdBillingPaymentMethodsMethodId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"methodId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/wallet":{"get":{"tags":["billing"],"summary":"Prepaid wallet balance, settings and recent ledger","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingWallet","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"walletView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/wallet/settings":{"put":{"tags":["billing"],"summary":"Low-balance alert, auto top-up and monthly cap","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdBillingWalletSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"walletSettingsBody","response":"walletView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts walletSettingsBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/wallet/topup":{"post":{"tags":["billing"],"summary":"Top up the wallet: the hosted form for a pending top-up; its tax invoice is issued when paid (from SAR 100)","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingWalletTopup","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"topupBody","response":"paymentIntent"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts topupBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/plan-options":{"get":{"tags":["billing"],"summary":"Plans the organisation may buy at its own country prices, its add-ons, and whether it may change the plan itself","description":"Permission: `billing.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingPlanOptions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"planOptions"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/plan-change/preview":{"get":{"tags":["billing"],"summary":"Proration of a plan change before it is made (upgrade now, downgrade at period end)","description":"Permission: `billing.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingPlanChangePreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"planChangeBody","response":"planChangePreview"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/plan-change":{"post":{"tags":["billing"],"summary":"Upgrade now: the new plan at once, a proration invoice and the hosted Moyasar form for it (billing switched on only)","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingPlanChange","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"planChangeBody","response":"planChangeResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts planChangeBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/plan-change/downgrade-check":{"get":{"tags":["billing"],"summary":"What to remove first before a downgrade at period end: limits above the smaller plan, monthly allowances, features lost","description":"Permission: `billing.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdBillingPlanChangeDowngradeCheck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"planChangeBody","response":"downgradeCheck"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/cancel":{"post":{"tags":["billing"],"summary":"Cancel at the end of the period: the plan stays usable until then, nothing is charged or refunded (billing switched on only)","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingCancel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"cancelBody","response":"cancelState"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts cancelBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/cancel/undo":{"post":{"tags":["billing"],"summary":"Keep the plan: withdraw an end-of-period cancellation while the period runs (billing switched on only)","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingCancelUndo","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"keepPlanBody","response":"cancelState"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts keepPlanBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/plan-change/schedule":{"post":{"tags":["billing"],"summary":"Schedule a smaller plan, or annual to monthly, for the end of the period: nothing is charged, refunded or prorated now; the billing run moves the plan and invoices the new price then (billing switched on only). 409 DOWNGRADE_DOES_NOT_FIT lists what to remove first; 409 SCHEDULE_BLOCKED (details.reason), DOWNGRADE_BELOW_MARGIN_FLOOR, ADDON_REQUIRED_BY, ADDON_NEEDS_ANNUAL_PLAN. The same target again answers the same state; another one replaces it","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingPlanChangeSchedule","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"planChangeBody","response":"scheduleState"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts planChangeBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/billing/plan-change/schedule/undo":{"post":{"tags":["billing"],"summary":"Undo the organisation's own scheduled plan change while the period runs (billing switched on only); one the account team scheduled answers 409 SCHEDULE_BLOCKED staff_schedule","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdBillingPlanChangeScheduleUndo","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"unscheduleBody","response":"scheduleState"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts unscheduleBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/billing/pay/{token}":{"get":{"tags":["billing"],"summary":"Signed pay link: the invoice it pays (no session)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1BillingPayToken","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"response":"payLinkView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["billing"],"summary":"Signed pay link: start the hosted form for that invoice","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1BillingPayToken","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"body":"payBody","response":"paymentIntent"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts payBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/oauth/token":{"post":{"tags":["oauth"],"summary":"OAuth 2.0 client-credentials grant (RFC 6749 4.4): client id and secret by HTTP Basic or in the form/JSON body; answers a short-lived bearer token for the public API (scheme oauthClient). Errors are RFC 6749 bodies (invalid_client, unauthorized_client when the plan lacks api_access, invalid_scope; 429 with Retry-After)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1OauthToken","security":[],"x-sayvara-contract":{"response":"oauthTokenAnswer"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/api-clients":{"get":{"tags":["api-clients"],"summary":"OAuth API clients (no secrets): scopes, IP allow-list, token lifetime","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdApiClients","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"apiClientList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["api-clients"],"summary":"Create an OAuth API client; the client secret is shown once (plan: api_access)","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdApiClients","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"apiClientInput","response":"apiClientCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts apiClientInput"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/api-clients/{id}":{"patch":{"tags":["api-clients"],"summary":"Change name, scopes, IP allow-list or token lifetime; narrower scopes apply to live tokens at once (plan: api_access)","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdApiClientsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"apiClient"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["api-clients"],"summary":"Revoke an OAuth API client and every token it holds","description":"Permission: `api_keys.manage`.","operationId":"deleteV1TenantsTenantIdApiClientsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/api-clients/{id}/rotate":{"post":{"tags":["api-clients"],"summary":"New client secret (shown once); graceMinutes 0 also stops every token issued before now (plan: api_access)","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdApiClientsIdRotate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"apiClientCreated"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/contact-centre/genesys/{connectionId}/events":{"post":{"tags":["contact-centre"],"summary":"Genesys Cloud end of conversation (bearer token of the connection, or Sayvara-Signature HMAC); recorded once per conversation, confirmed with Genesys, then published for the survey trigger. 202, 200 duplicate, 401, 403 plan, 404, 429 with Retry-After","operationId":"postV1ContactCentreGenesysConnectionIdEvents","security":[{"signature":[]}],"parameters":[{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/contact-centre/genesys":{"get":{"tags":["contact-centre"],"summary":"Genesys Cloud connections, webhook URLs and 7-day reconciliation counters (plan: group_integrations)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdContactCentreGenesys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ccConnectionList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["contact-centre"],"summary":"Connect a Genesys Cloud organisation with an OAuth client (proved with a token); the webhook secret is shown once","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdContactCentreGenesys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ccConnected"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/contact-centre/genesys/{id}":{"patch":{"tags":["contact-centre"],"summary":"Change a connection: pause, webhook mode, confirmation, score write-back target, rate, or OAuth client","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdContactCentreGenesysId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ccConnection"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["contact-centre"],"summary":"Disconnect; both vault secrets are removed","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdContactCentreGenesysId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/contact-centre/genesys/{id}/hook-secret":{"post":{"tags":["contact-centre"],"summary":"New webhook secret (shown once); the old one stops at once","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdContactCentreGenesysIdHookSecret","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ccHookSecret"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/contact-centre/genesys/{id}/test":{"post":{"tags":["contact-centre"],"summary":"Test the connection: the organisation read, then one read-only or refused-write probe per Genesys permission the connector uses (nothing is created or changed in Genesys); answers checks (name to ok or a code) and permissions [{name, status ok | missing_permission | error, permission, reason, optional, inferred (ok from a 404 or 400 only)}], plus the divisions the OAuth client holds the analytics permission in (advisory); ok false with reason other_organisation when the client signs in to a different organisation","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdContactCentreGenesysIdTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ccTestResult"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/contact-centre/genesys/{id}/architect-export":{"get":{"tags":["contact-centre"],"summary":"Genesys Architect export for one connection (add-on, available on request): the Web Services data action JSON (bearer token read from the integration credential field `token`, never embedded), the Archy workflow YAML, the conversation-end trigger body and a README. ready is true when the connection takes token webhooks, is active and confirms each conversation with Genesys (the workflow posts only the conversation id); webhook intake mode is recommended. With the tenant flag contact_centre.genesys_ivr on, ivr adds the keypad survey data actions (ivr-script, ivr-answers), the Archy inbound call flow and its README. 404 for another tenant's or an unknown connection","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdContactCentreGenesysIdArchitectExport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/contact-centre/genesys/{connectionId}/ivr-answers":{"post":{"tags":["contact-centre"],"summary":"Genesys Cloud keypad survey answers from an Architect flow (bearer token of the connection, or Sayvara-Signature HMAC; plan group_integrations and channels.voice; tenant flag contact_centre.genesys_ivr). Each answer is checked against the survey's phone script and stored as one voice response per conversation (source ivr); a slot that does not fit is dropped and named in dropped; optOut puts the caller's number on the tenant's do-not-call list before any other check. 202 stored, empty, opted_out, opt_out_unsaved or paused, 200 duplicate, 400, 401, 403, 404 (also while the flag is off), 422 survey not askable by phone, 429, 503","operationId":"postV1ContactCentreGenesysConnectionIdIvrAnswers","security":[{"signature":[]}],"parameters":[{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/contact-centre/genesys/{connectionId}/ivr-script":{"post":{"tags":["contact-centre"],"summary":"The phone script an Architect flow plays for a survey (body: surveyId, lang, ani; intro, one to five number questions, thanks) in one language, with the keys Collect Input takes and the opt-out keys; ani answers whether the number is on the do-not-call list and is never stored or put in a URL. Same auth, plan and flag as ivr-answers. 200, 400, 401, 403, 404 (also while the flag is off), 422, 429","operationId":"postV1ContactCentreGenesysConnectionIdIvrScript","security":[{"signature":[]}],"parameters":[{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connect/dynamics":{"get":{"tags":["contact-centre"],"summary":"Dynamics 365 Connect with Microsoft: whether the platform app is configured, the role name, and the verified grants (plan: group_integrations)","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdConnectDynamics","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connect/dynamics/start":{"post":{"tags":["contact-centre"],"summary":"Start Connect with Microsoft for one Dataverse environment ({ environmentHost }): sets a short sealed flow cookie and answers the Microsoft sign-in URL","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdConnectDynamicsStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/connect/dynamics/{host}":{"delete":{"tags":["contact-centre"],"summary":"Forget the grant for an environment; platform tokens stop (the application user stays until the customer removes it)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdConnectDynamicsHost","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"host","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/connect/dynamics/callback":{"get":{"tags":["contact-centre"],"summary":"Microsoft returns the browser here with code and state (flow cookie): sets up the role and application user, records the grant; 303 to Integrations > CRM with dynamics=connected or dynamics=error&code=<code>","operationId":"getV1ConnectDynamicsCallback","security":[],"responses":{"303":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reconciliation":{"get":{"tags":["integrations"],"summary":"IN-19 reconciliation report per connection: events received, surveys sent, answers written back, failures and retries per UTC day; ?days=1..90, default 14; only measured days (plan: group_integrations)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReconciliation","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"reconciliationQuery","response":"reconciliationReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/warehouse":{"get":{"tags":["warehouse"],"summary":"Warehouse destinations (no secrets) with export positions per stream, the kinds this tenant can set up (S3-compatible always; BigQuery, Snowflake and Microsoft Fabric when turned on for the tenant), and the kinds not built yet (never shown on screen)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWarehouse","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"warehouseList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/warehouse/{kind}":{"put":{"tags":["warehouse"],"summary":"Create or change the destination of this kind (s3, bigquery, snowflake or fabric, each with its own settings): streams, contact fields (ids or masked), free text on or off, interval; the secret (access key, service account key, private key or client secret) is write-only","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdWarehouseKind","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"warehouseDestinationInput","response":"warehouseDestination"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts warehouseDestinationInput"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["warehouse"],"summary":"Remove the destination; the secret key is removed from the vault (files and tables already written stay where they are)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdWarehouseKind","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/warehouse/{kind}/run":{"post":{"tags":["warehouse"],"summary":"Export now (picked up within 5 minutes); 409 while a run is going","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdWarehouseKindRun","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"warehouseDestination"},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/warehouse/{kind}/test":{"post":{"tags":["warehouse"],"summary":"Connection test with the stored secret, no customer data: S3 and Fabric write a small test file, BigQuery reads the dataset, Snowflake stages a test file and runs a query","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdWarehouseKindTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"warehouseTestResult"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/warehouse/{kind}/runs":{"get":{"tags":["warehouse"],"summary":"The newest 20 export runs","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWarehouseKindRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"warehouseRunList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/embed":{"get":{"tags":["embeds"],"summary":"Embed tokens of the organisation (no tokens): dashboard, widgets, range, allowed parent origins, status","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdEmbed","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"embedTokenList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["embeds"],"summary":"Create a signed, expiring, read-only embed token; the token, frame URL and iframe snippet are shown once (plan: api_access; 503 until EMBED_TOKEN_SECRET is set)","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdEmbed","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"embedTokenCreateBody","response":"embedTokenCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts embedTokenCreateBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/embed/{embedId}":{"delete":{"tags":["embeds"],"summary":"Revoke an embed token at once","description":"Permission: `api_keys.manage`.","operationId":"deleteV1TenantsTenantIdEmbedEmbedId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"embedId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/embed/frame/{embedId}":{"get":{"tags":["embeds"],"summary":"The embed frame page (HTML; token in the URL fragment #t=...; ?lang=en|ar, &theme=light|dark). CSP frame-ancestors = the allowed origins of the token","operationId":"getV1EmbedFrameEmbedId","security":[],"parameters":[{"name":"embedId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/embed/data":{"post":{"tags":["embeds"],"summary":"The numbers of an embed for { token }: aggregates only. 404 invalid, 410 plan or organisation, 429 with Retry-After, 503 not set up","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1EmbedData","security":[],"x-sayvara-contract":{"body":"embedDataBody","response":"embedData"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts embedDataBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/embed/signing":{"get":{"tags":["embeds"],"summary":"Signed-embed settings of the organisation: on or off, parent origins, white-label theme, key version (never the key)","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdEmbedSigning","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"embedSigning"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["embeds"],"summary":"Turn signed embeds on or off, set parent origins and theme; the first save makes the signing key in the tenant vault (tenant-wide owners and admins; plan: api_access)","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdEmbedSigning","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"embedSigningBody","response":"embedSigning"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts embedSigningBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/embed/signing/rotate":{"post":{"tags":["embeds"],"summary":"Rotate the signing key: every signed token issued before stops at once (tenant-wide owners and admins; 409 while off)","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdEmbedSigningRotate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"embedSigning"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/embed/signed-tokens":{"post":{"tags":["embeds"],"summary":"Issue a short-lived signed embed token (JWT HS256, 1-60 minutes) for a dashboard and its tiles, with org-unit and attribute claims inside the caller's scope; shown once (plan: api_access; 409 while off)","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdEmbedSignedTokens","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"signedEmbedIssueBody","response":"signedEmbedIssued"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts signedEmbedIssueBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/embed/s/{tenantId}/frame":{"get":{"tags":["embeds"],"summary":"The organisation's white-labelled signed-embed frame (HTML; token in the URL fragment #t=...; ?lang=en|ar, &theme=light|dark). CSP frame-ancestors = its parent origins; 404 while off","operationId":"getV1EmbedSTenantIdFrame","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/embed/s/{tenantId}/data":{"post":{"tags":["embeds"],"summary":"The numbers for a signed token { token }: verified on every read (tenant, key version, mac, audience, expiry), read with its org-unit and attribute claims; aggregates only. 404 invalid, 410 plan or organisation, 429 with Retry-After","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1EmbedSTenantIdData","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"signedEmbedDataBody","response":"signedEmbedData"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts signedEmbedDataBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/me":{"get":{"tags":["automation"],"summary":"Connection test for Zapier, Make and Power Automate: the organisation and the key's scopes (API key or OAuth client token, scope responses.read; plan api_access)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1AutomationMe","security":[],"x-sayvara-contract":{"response":"automationMe"},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/hooks":{"get":{"tags":["automation"],"summary":"REST hooks of this organisation (API key or OAuth client token, scope responses.read; plan api_access)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1AutomationHooks","security":[],"x-sayvara-contract":{"response":"automationHookList"},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["automation"],"summary":"Subscribe an https target URL to one outbound webhook event: response.completed, detractor.flagged (the organisation's detractor thresholds), ticket.opened, ticket.updated or ticket.closed. Events from now on are delivered like any outbound webhook: signed envelope (ids and scores only), retries with backoff, dead letter. The signing secret is answered once and Location names the hook. 409 AUTOMATION_HOOK_LIMIT past 100 hooks (API key or OAuth client token, scope responses.read; plan api_access)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1AutomationHooks","security":[],"x-sayvara-contract":{"body":"automationSubscribeInput","response":"automationHookCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts automationSubscribeInput"}}}},"responses":{"201":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/hooks/{event}":{"post":{"tags":["automation"],"summary":"The same subscription with the event in the path (one operation per trigger, for Power Automate); Location names the hook (API key or OAuth client token, scope responses.read; plan api_access)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1AutomationHooksEvent","security":[],"parameters":[{"name":"event","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"automationSubscribeInput","response":"automationHookCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts automationSubscribeInput"}}}},"responses":{"201":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/hooks/{id}":{"delete":{"tags":["automation"],"summary":"Unsubscribe a REST hook made through these routes; its delivery log goes with it (API key or OAuth client token, scope responses.read; plan api_access)","operationId":"deleteV1AutomationHooksId","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/samples/{event}":{"get":{"tags":["automation"],"summary":"One sample envelope of an event, marked test: true, for field mapping (API key or OAuth client token, scope responses.read; plan api_access)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1AutomationSamplesEvent","security":[],"parameters":[{"name":"event","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"automationSampleList"},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/surveys":{"get":{"tags":["automation"],"summary":"The organisation's live surveys (id, name, metric), by name, for the Survey dropdown of the send-survey action (API key or OAuth client token, scope responses.read; plan api_access)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1AutomationSurveys","security":[],"x-sayvara-contract":{"response":"automationSurveyList"},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/recent/{event}":{"get":{"tags":["automation"],"summary":"Up to 3 of the organisation's latest events of one kind as delivery envelopes (test: false), newest first, for field mapping; empty when there is none yet (API key or OAuth client token, scope responses.read; plan api_access)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1AutomationRecentEvent","security":[],"parameters":[{"name":"event","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"automationRecentList"},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/actions/contacts":{"post":{"tags":["automation"],"summary":"Create a contact, or fill the empty fields of the one with this phone (else email); never overwrites (API key or OAuth client token, scope contacts.write; plan api_access)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1AutomationActionsContacts","security":[],"x-sayvara-contract":{"body":"automationContactInput","response":"automationContactResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts automationContactInput"}}}},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/events":{"get":{"tags":["automation"],"summary":"The versioned webhook event catalogue: the Sayvara-Signature scheme (HMAC-SHA256 of t.body, 300 s replay window), retries and backoff, and every event with status emitted or not_emitted. Emitted events carry a JSON Schema and an example (test: true); not-emitted events are not subscribable","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1AutomationEvents","security":[],"x-sayvara-contract":{"response":"webhookCatalogue"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/automation/events/{event}":{"get":{"tags":["automation"],"summary":"One event of the webhook catalogue with its JSON Schema and example; 404 for a name that is not in the catalogue","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1AutomationEventsEvent","security":[],"parameters":[{"name":"event","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"webhookCatalogueEntry"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/automation/hooks":{"get":{"tags":["automation"],"summary":"Settings > API access: the REST hooks platforms subscribed with this organisation's keys, with their health","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAutomationHooks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"automationHookList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/automation/hooks/{id}":{"delete":{"tags":["automation"],"summary":"Remove a REST hook (the platform's automation stops receiving events)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdAutomationHooksId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/status":{"get":{"tags":["install"],"summary":"Whether the first-run wizard is open (no auth)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallSetupStatus","security":[],"x-sayvara-contract":{"response":"setupStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup":{"get":{"tags":["install"],"summary":"The wizard's state: licence, hosts, owner, organisation, channels, connectivity, steps done (setup code; 409 SETUP_COMPLETED after the wizard finished)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallSetup","security":[],"x-sayvara-contract":{"response":"setupState"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/licence/check":{"post":{"tags":["install"],"summary":"Verify a licence text offline against the installed key ring; nothing is written (setup code; 409 SETUP_COMPLETED after the wizard finished)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallSetupLicenceCheck","security":[],"x-sayvara-contract":{"response":"licenceCheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"licence":{"type":"string","minLength":10,"maxLength":64000}},"required":["licence"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/licence/confirm":{"post":{"tags":["install"],"summary":"Accept the installed licence and create the installation's organisation (setup code; 409 SETUP_COMPLETED after the wizard finished)","operationId":"postV1InstallSetupLicenceConfirm","security":[],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/hosts":{"put":{"tags":["install"],"summary":"Host names and TLS: the certificate is checked, the private key sealed in the secret store (setup code; 409 SETUP_COMPLETED after the wizard finished)","operationId":"putV1InstallSetupHosts","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"mode":{"type":"string","enum":["single","split"]},"appHost":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"},"surveyHost":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"},"apiHost":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"},"tls":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"upload"},"certPem":{"type":"string","maxLength":64000},"keyPem":{"type":"string","maxLength":64000,"pattern":"-----BEGIN (RSA |EC |ENCRYPTED )?PRIVATE KEY-----"}},"required":["kind","certPem","keyPem"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"self_signed"}},"required":["kind"],"additionalProperties":false}]}},"required":["mode","appHost","tls"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/owner":{"post":{"tags":["install"],"summary":"Create the break-glass install owner and start the authenticator setup (secret shown once) (setup code; 409 SETUP_COMPLETED after the wizard finished)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallSetupOwner","security":[],"x-sayvara-contract":{"response":"ownerEnrolment"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","maxLength":254},"password":{"type":"string","minLength":14,"maxLength":256},"locale":{"type":"string","enum":["ar","en"]}},"required":["name","email","password","locale"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/owner/verify":{"post":{"tags":["install"],"summary":"Confirm the owner's first authenticator code; the recovery codes are shown once (setup code; 409 SETUP_COMPLETED after the wizard finished)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallSetupOwnerVerify","security":[],"x-sayvara-contract":{"response":"ownerRecovery"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["code"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/organisation":{"put":{"tags":["install"],"summary":"Organisation names, time zone, calendar, weekend and language (setup code; 409 SETUP_COMPLETED after the wizard finished)","operationId":"putV1InstallSetupOrganisation","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nameEn":{"type":"string","minLength":1,"maxLength":200},"nameAr":{"type":"string","minLength":1,"maxLength":200},"timeZone":{"type":"string","minLength":3,"maxLength":64},"calendar":{"type":"string","enum":["hijri","gregorian"]},"weekend":{"type":"string","enum":["fri_sat","sat_sun","fri","sun"]},"language":{"type":"string","enum":["ar","en"]}},"required":["nameEn","nameAr","timeZone","calendar","weekend","language"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/channels/smtp":{"put":{"tags":["install"],"summary":"The customer's own SMTP relay (optional; the password is write-only) (setup code; 409 SETUP_COMPLETED after the wizard finished)","operationId":"putV1InstallSetupChannelsSmtp","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"host":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"},"port":{"type":"integer","minimum":1,"maximum":65535},"security":{"type":"string","enum":["starttls","tls","none"]},"username":{"type":"string","minLength":1,"maxLength":200},"password":{"type":"string","minLength":1,"maxLength":500},"fromAddress":{"type":"string","maxLength":254},"fromName":{"type":"string","minLength":1,"maxLength":100}},"required":["host","port","security","fromAddress"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["install"],"summary":"Remove the SMTP relay settings (setup code; 409 SETUP_COMPLETED after the wizard finished)","operationId":"deleteV1InstallSetupChannelsSmtp","security":[],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/connectivity":{"put":{"tags":["install"],"summary":"Connectivity profile, outbound allow-list and the data residency acknowledgement (setup code; 409 SETUP_COMPLETED after the wizard finished)","operationId":"putV1InstallSetupConnectivity","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"profile":{"type":"string","enum":["air-gapped","egress-only","dmz"]},"allowList":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"}},"residencyAck":{"type":"boolean","const":true}},"required":["profile","residencyAck"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/sso":{"put":{"tags":["install"],"summary":"Optional: the sign-in kinds to add in Settings after setup, or local accounts only (the last checks are kept) (setup code; 409 SETUP_COMPLETED after the wizard finished)","operationId":"putV1InstallSetupSso","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"choice":{"type":"string","enum":["later","none"]},"kinds":{"default":[],"maxItems":5,"type":"array","items":{"type":"string","enum":["entra","google","oidc","saml","ldap"]}}},"required":["choice"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/backup":{"put":{"tags":["install"],"summary":"Optional: the planned backup target, a folder or an S3-compatible store (sayvara-ctl backup target set puts it in use) (setup code; 409 SETUP_COMPLETED after the wizard finished)","operationId":"putV1InstallSetupBackup","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"path"},"targetPath":{"type":"string","minLength":2,"maxLength":255,"pattern":"^(?:\\/(?!\\.{1,2}(?:\\/|$))[A-Za-z0-9._-]+)+\\/?$"}},"required":["targetPath"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"s3"},"endpoint":{"type":"string","maxLength":255,"format":"uri"},"bucket":{"type":"string","pattern":"^[a-z0-9.-]{3,63}$"},"prefix":{"default":"sayvara/","type":"string","pattern":"^[A-Za-z0-9._/-]{0,100}$"},"region":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9-]+$"}},"required":["kind","endpoint","bucket"],"additionalProperties":false}]}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/sso/readiness":{"get":{"tags":["install"],"summary":"Single sign-on: what this installation can do per kind (switches, server settings, network) and the redirect addresses; no network call (setup code; 409 SETUP_COMPLETED after the wizard finished)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallSetupSsoReadiness","security":[],"x-sayvara-contract":{"response":"installSsoReadiness"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/sso/check/ldap":{"post":{"tags":["install"],"summary":"Check a directory: TLS with the sign-in rules, then an anonymous read of its root entry; no bind, no password (409 LDAP_SWITCH_OFF while the switch is off) (setup code; 409 SETUP_COMPLETED after the wizard finished)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallSetupSsoCheckLdap","security":[],"x-sayvara-contract":{"body":"ssoLdapCheckInput","response":"ssoLdapCheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","minLength":8,"maxLength":300},"startTls":{"default":false,"type":"boolean"}},"required":["url"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/sso/check/saml":{"post":{"tags":["install"],"summary":"Check an IdP metadata file: entity id, sign-in host and signing certificates (read, never fetched) (setup code; 409 SETUP_COMPLETED after the wizard finished)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallSetupSsoCheckSaml","security":[],"x-sayvara-contract":{"body":"ssoSamlCheckInput","response":"ssoSamlCheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"metadataXml":{"type":"string","minLength":50,"maxLength":200000}},"required":["metadataXml"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/sso/check/oidc":{"post":{"tags":["install"],"summary":"Check an OpenID Connect issuer: its discovery document over public HTTPS (409 AIR_GAPPED, nothing fetched, on an air-gapped install) (setup code; 409 SETUP_COMPLETED after the wizard finished)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallSetupSsoCheckOidc","security":[],"x-sayvara-contract":{"body":"ssoOidcCheckInput","response":"ssoOidcCheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"issuer":{"type":"string","minLength":10,"maxLength":500}},"required":["issuer"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/setup/complete":{"post":{"tags":["install"],"summary":"Finish the wizard (every required step done; 409 SETUP_INCOMPLETE lists the rest) (setup code; 409 SETUP_COMPLETED after the wizard finished)","operationId":"postV1InstallSetupComplete","security":[],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/overview":{"get":{"tags":["install"],"summary":"Installation overview: licence, release, hosts and TLS, organisation, connectivity, channels, warnings","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminOverview","security":[{"session":[]}],"x-sayvara-contract":{"response":"installOverview"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/licence/check":{"post":{"tags":["install"],"summary":"Check a re-issued licence before importing it (nothing is written)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminLicenceCheck","security":[{"session":[]}],"x-sayvara-contract":{"response":"licenceCheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"licence":{"type":"string","minLength":10,"maxLength":64000}},"required":["licence"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/licence/import":{"post":{"tags":["install"],"summary":"Import a re-issued licence: verified offline, in force at once without a restart (audited)","operationId":"postV1InstallAdminLicenceImport","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"licence":{"type":"string","minLength":10,"maxLength":64000}},"required":["licence"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/hosts":{"put":{"tags":["install"],"summary":"Change host names or replace the TLS certificate","operationId":"putV1InstallAdminHosts","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"mode":{"type":"string","enum":["single","split"]},"appHost":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"},"surveyHost":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"},"apiHost":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"},"tls":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"upload"},"certPem":{"type":"string","maxLength":64000},"keyPem":{"type":"string","maxLength":64000,"pattern":"-----BEGIN (RSA |EC |ENCRYPTED )?PRIVATE KEY-----"}},"required":["kind","certPem","keyPem"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"self_signed"}},"required":["kind"],"additionalProperties":false}]}},"required":["mode","appHost","tls"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/organisation":{"put":{"tags":["install"],"summary":"Change the organisation names and defaults","operationId":"putV1InstallAdminOrganisation","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nameEn":{"type":"string","minLength":1,"maxLength":200},"nameAr":{"type":"string","minLength":1,"maxLength":200},"timeZone":{"type":"string","minLength":3,"maxLength":64},"calendar":{"type":"string","enum":["hijri","gregorian"]},"weekend":{"type":"string","enum":["fri_sat","sat_sun","fri","sun"]},"language":{"type":"string","enum":["ar","en"]}},"required":["nameEn","nameAr","timeZone","calendar","weekend","language"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/channels/smtp":{"put":{"tags":["install"],"summary":"Change the SMTP relay (the password is write-only)","operationId":"putV1InstallAdminChannelsSmtp","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"host":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"},"port":{"type":"integer","minimum":1,"maximum":65535},"security":{"type":"string","enum":["starttls","tls","none"]},"username":{"type":"string","minLength":1,"maxLength":200},"password":{"type":"string","minLength":1,"maxLength":500},"fromAddress":{"type":"string","maxLength":254},"fromName":{"type":"string","minLength":1,"maxLength":100}},"required":["host","port","security","fromAddress"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["install"],"summary":"Remove the SMTP relay settings","operationId":"deleteV1InstallAdminChannelsSmtp","security":[{"session":[]}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/connectivity":{"put":{"tags":["install"],"summary":"Change the connectivity profile and allow-list","operationId":"putV1InstallAdminConnectivity","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"profile":{"type":"string","enum":["air-gapped","egress-only","dmz"]},"allowList":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","maxLength":253,"pattern":"^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"}},"residencyAck":{"type":"boolean","const":true}},"required":["profile","residencyAck"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/backups":{"get":{"tags":["install"],"summary":"Backups: last run, newest good run and complete sets from the status file sayvara-ctl writes (read-only)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminBackups","security":[{"session":[]}],"x-sayvara-contract":{"response":"installBackups"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/updates":{"get":{"tags":["install"],"summary":"Updates: release, history (install_updates), last update check and compatibility rows from the status file sayvara-ctl writes (read-only; updates run on the server)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminUpdates","security":[{"session":[]}],"x-sayvara-contract":{"response":"installUpdates"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/health":{"get":{"tags":["install"],"summary":"Health: the API, database, Valkey and survey runtime checks the API can make, and the worker processes connected to the job queue with its depth (states and counts only)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminHealth","security":[{"session":[]}],"x-sayvara-contract":{"response":"installHealth"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/logs":{"get":{"tags":["install"],"summary":"Logs, newest first: ?source=api (the API's own recent lines, masked, held in memory since it started), worker (jobs that failed after every retry), worker_log (the worker's own newest lines, masked, at most 500; on-prem Valkey) or activity (install.* audit rows); ?limit=1..200, default 100 (read-only)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminLogs","security":[{"session":[]}],"x-sayvara-contract":{"query":"installLogsQuery","response":"installLogs"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/security":{"get":{"tags":["install"],"summary":"Security: install admins and two-step verification, single sign-on connections and enforcement, the wizard SSO choice and its last checks, and SSO readiness","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminSecurity","security":[{"session":[]}],"x-sayvara-contract":{"response":"installSecurity"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/sso/readiness":{"get":{"tags":["install"],"summary":"Single sign-on readiness per kind, as in the wizard (no network call)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminSsoReadiness","security":[{"session":[]}],"x-sayvara-contract":{"response":"installSsoReadiness"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/sso/check/ldap":{"post":{"tags":["install"],"summary":"Check a directory: TLS and an anonymous root entry read; no bind (audited install.sso.checked)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminSsoCheckLdap","security":[{"session":[]}],"x-sayvara-contract":{"body":"ssoLdapCheckInput","response":"ssoLdapCheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","minLength":8,"maxLength":300},"startTls":{"default":false,"type":"boolean"}},"required":["url"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/sso/check/saml":{"post":{"tags":["install"],"summary":"Check an IdP metadata file (read, never fetched; audited)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminSsoCheckSaml","security":[{"session":[]}],"x-sayvara-contract":{"body":"ssoSamlCheckInput","response":"ssoSamlCheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"metadataXml":{"type":"string","minLength":50,"maxLength":200000}},"required":["metadataXml"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/sso/check/oidc":{"post":{"tags":["install"],"summary":"Check the discovery document of an OpenID Connect issuer (not air-gapped; audited)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminSsoCheckOidc","security":[{"session":[]}],"x-sayvara-contract":{"body":"ssoOidcCheckInput","response":"ssoOidcCheck"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"issuer":{"type":"string","minLength":10,"maxLength":500}},"required":["issuer"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/admins":{"get":{"tags":["install"],"summary":"Who may open the installation admin","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminAdmins","security":[{"session":[]}],"x-sayvara-contract":{"response":"installAdminList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["install"],"summary":"Add an install admin (install owner only; an active member of the organisation)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminAdmins","security":[{"session":[]}],"x-sayvara-contract":{"response":"installAdmin"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"email":{"type":"string","maxLength":254},"role":{"type":"string","const":"install_admin"}},"required":["email","role"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/support-account":{"get":{"tags":["install"],"summary":"The support account (install owner only): the newest one with its case reference, access, who started it, expiry and state, or none, and the server clock","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminSupportAccount","security":[{"session":[]}],"x-sayvara-contract":{"response":"installSupportView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["install"],"summary":"Start a time-limited support account (install owner only; 1-72 hours; refused while one is active): the one-time password is in this answer only, two-step verification is set up at first sign-in","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminSupportAccount","security":[{"session":[]}],"x-sayvara-contract":{"body":"installSupportStartInput","response":"installSupportStarted"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"caseRef":{"type":"string","pattern":"^[a-z0-9-]{1,32}$"},"access":{"type":"string","enum":["read_only","read_write"]},"hours":{"type":"integer","minimum":1,"maximum":72}},"required":["caseRef","access","hours"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["install"],"summary":"End the support account now (install owner only): its user is disabled, its membership suspended, its sessions deleted","operationId":"deleteV1InstallAdminSupportAccount","security":[{"session":[]}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/admins/{userId}":{"delete":{"tags":["install"],"summary":"Remove an install admin (install owner only; never the break-glass owner or yourself)","operationId":"deleteV1InstallAdminAdminsUserId","security":[{"session":[]}],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/agencies":{"get":{"tags":["install"],"summary":"Agency tenants of a multi-unit installation, the licence limit and each agency's admins","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminAgencies","security":[{"session":[]}],"x-sayvara-contract":{"response":"agencyList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["install"],"summary":"Create an agency tenant within the licence limit (409 TOPOLOGY_SINGLE, AGENCY_LIMIT)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminAgencies","security":[{"session":[]}],"x-sayvara-contract":{"response":"agencyView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nameEn":{"type":"string","minLength":1,"maxLength":200},"nameAr":{"type":"string","minLength":1,"maxLength":200},"adminEmail":{"type":"string","maxLength":254}},"required":["nameEn","nameAr"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/agencies/{agencyId}/admins":{"post":{"tags":["install"],"summary":"Make an active member of the ministry an owner or admin of the agency (404 MEMBER_NOT_FOUND otherwise)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminAgenciesAgencyIdAdmins","security":[{"session":[]}],"parameters":[{"name":"agencyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"agencyView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"email":{"type":"string","maxLength":254},"role":{"default":"admin","type":"string","enum":["owner","admin"]}},"required":["email"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/ministry-viewers":{"get":{"tags":["install"],"summary":"Who may read the ministry roll-up","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallAdminMinistryViewers","security":[{"session":[]}],"x-sayvara-contract":{"response":"ministryViewerList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["install"],"summary":"Add a ministry viewer (an active member of the ministry)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminMinistryViewers","security":[{"session":[]}],"x-sayvara-contract":{"response":"ministryViewer"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"email":{"type":"string","maxLength":254}},"required":["email"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/ministry-viewers/{userId}":{"delete":{"tags":["install"],"summary":"Remove a ministry viewer","operationId":"deleteV1InstallAdminMinistryViewersUserId","security":[{"session":[]}],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/ministry/rollup":{"get":{"tags":["install"],"summary":"Counts and scores per unit for ministry viewers over a fixed period (last_30, last_90 or an ended month); no personal data, small units withheld, also in the total","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallMinistryRollup","security":[{"session":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"default":"last_30","type":"string","enum":["last_30","last_90","month"]}},{"name":"month","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}}],"x-sayvara-contract":{"response":"ministryRollup"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/ministry/access":{"get":{"tags":["install"],"summary":"Whether this session may open the ministry roll-up ({ viewer }), so the menu shows it only to ministry viewers; not audited","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1InstallMinistryAccess","security":[{"session":[]}],"x-sayvara-contract":{"response":"ministryAccess"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/agencies/{agencyId}":{"patch":{"tags":["install"],"summary":"Rename an agency in English and/or Arabic (409 AGENCY_CLOSED)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1InstallAdminAgenciesAgencyId","security":[{"session":[]}],"parameters":[{"name":"agencyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"agencyView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nameEn":{"type":"string","minLength":1,"maxLength":200},"nameAr":{"type":"string","minLength":1,"maxLength":200}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/agencies/{agencyId}/close":{"post":{"tags":["install"],"summary":"Close an agency with a reason: no sign-in and no sends; its data stays; open in read-only too (400 CONFIRM_MISMATCH, 409 AGENCY_CLOSED)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminAgenciesAgencyIdClose","security":[{"session":[]}],"parameters":[{"name":"agencyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"agencyView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"confirm":{"type":"string","minLength":1,"maxLength":200},"reason":{"type":"string","minLength":3,"maxLength":1000}},"required":["confirm","reason"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/install/admin/agencies/{agencyId}/reopen":{"post":{"tags":["install"],"summary":"Reopen a closed agency with a reason, within the licence limit (409 AGENCY_NOT_CLOSED, AGENCY_LIMIT, TOPOLOGY_SINGLE)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1InstallAdminAgenciesAgencyIdReopen","security":[{"session":[]}],"parameters":[{"name":"agencyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"agencyView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"reason":{"type":"string","minLength":3,"maxLength":1000}},"required":["reason"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voc-packs/status":{"get":{"tags":["reports"],"summary":"Whether VoC report packs are on for the organisation: { on }","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdVocPacksStatus","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"vocPacksStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voc-packs":{"get":{"tags":["reports"],"summary":"The VoC report packs, each with its live schedules and latest run, and whether scheduled delivery is on","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdVocPacks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"vocPackList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["reports"],"summary":"Create a VoC report pack (name, lead measure, unit, surveys, sections)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdVocPacks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"vocPackCreate","response":"vocPackDto"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts vocPackCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voc-packs/{id}":{"patch":{"tags":["reports"],"summary":"Change a VoC report pack","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdVocPacksId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"vocPackUpdate","response":"vocPackDto"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts vocPackUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["reports"],"summary":"Delete a VoC report pack and its recommendations (409 VOC_PACK_SCHEDULED while a live schedule sends it)","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdVocPacksId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voc-packs/{id}/recommendations":{"get":{"tags":["reports"],"summary":"The analyst recommendations of a pack for one period (empty items when none are saved)","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdVocPacksIdRecommendations","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"recommendationsQuery","response":"recommendationsDto"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["reports"],"summary":"Save the analyst recommendations of a pack for one period (at most 10, each in Arabic and English)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdVocPacksIdRecommendations","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"recommendationsPut","response":"recommendationsDto"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts recommendationsPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voc-packs/{id}/runs":{"post":{"tags":["reports"],"summary":"Make a pack now for one whole period, to download or send to members (400 PERIOD_INVALID, 400 RECIPIENT_NOT_ALLOWED, 429, 503 REPORT_RUN_UNAVAILABLE)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdVocPacksIdRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"reportRunCreate","response":"reportRunAccepted"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts reportRunCreate"}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-runs":{"get":{"tags":["reports"],"summary":"The latest 50 VoC pack runs, optionally of one pack","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"reportRunListQuery","response":"reportRunList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/report-runs/{runId}/file":{"get":{"tags":["reports"],"summary":"Download one file of a run: a redirect to a 5-minute link (409 RUN_NOT_READY while it is being made)","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportRunsRunIdFile","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"reportRunFileQuery"},"responses":{"302":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/transactions":{"get":{"tags":["integrations"],"summary":"Ministry transactions newest first, each with its linked answer and match method (none when the answer was erased or anonymised; comment masked as in the responses list; no source for branch-scoped members); each page records a view of the answers it shows","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTransactions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"txnListQuery","response":"txnList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/transactions/report":{"get":{"tags":["integrations"],"summary":"Satisfaction by transaction (service, channel, status, processing time, branch, month or source): counts always, scores hidden for a small group (under 5 answers) or to protect a small group, an erased or anonymised answer counted as none, the processing-time insight in the processing grouping; statistics rate limit (429); sourceId needs whole-organisation access (403 TXN_SCOPE_LIMITED)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTransactionsReport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"txnReportQuery","response":"txnReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/transactions/report.csv":{"get":{"tags":["integrations"],"summary":"The same report as CSV (UTF-8 with a BOM, English then Arabic header row, hidden scores blank with the column \"Scores hidden (a small group, or to protect a small group)\", total row keyed _total); audited as transactions.report_exported; export rate limits (429)","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTransactionsReportCsv","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"txnReportQuery"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/venues":{"get":{"tags":["field"],"summary":"Field venues (stadiums, clubs, sports cities, events, offices) with their city, position, days, Riyadh-day state and visits (?include=all: archived and long-ended too)","description":"Permission: `field.manage`.","operationId":"getV1TenantsTenantIdFieldVenues","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","required":false,"schema":{"default":"current","type":"string","enum":["current","all"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["field"],"summary":"Add a venue: a new branch in the org tree and its venue facts, in one step (422 FIELD_VENUE_KIND when the parent's units are not branches; 409 UNIT_CODE_TAKEN)","description":"Permission: `org.write`.","operationId":"postV1TenantsTenantIdFieldVenues","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"parentId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"nameEn":{"type":"string","minLength":1,"maxLength":200},"nameAr":{"type":"string","minLength":1,"maxLength":200},"code":{"anyOf":[{"type":"string","minLength":1,"maxLength":40,"pattern":"^[\\p{L}\\p{N}][\\p{L}\\p{N} ._/-]*$"},{"type":"null"}]},"type":{"type":"string","enum":["stadium","club","sports_city","event","office","other"]},"cityEn":{"anyOf":[{"type":"string","minLength":1,"maxLength":80},{"type":"null"}]},"cityAr":{"anyOf":[{"type":"string","minLength":1,"maxLength":80},{"type":"null"}]},"lat":{"anyOf":[{"type":"number","minimum":-90,"maximum":90},{"type":"null"}]},"lng":{"anyOf":[{"type":"number","minimum":-180,"maximum":180},{"type":"null"}]},"startsOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"endsOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]}},"required":["parentId","nameEn","nameAr","type"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/field/venues/{orgUnitId}":{"patch":{"tags":["field"],"summary":"Change a venue's type, city, position or days (names, code and archive go through /org-units)","description":"Permission: `org.write`.","operationId":"patchV1TenantsTenantIdFieldVenuesOrgUnitId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"orgUnitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"type":{"type":"string","enum":["stadium","club","sports_city","event","office","other"]},"cityEn":{"anyOf":[{"type":"string","minLength":1,"maxLength":80},{"type":"null"}]},"cityAr":{"anyOf":[{"type":"string","minLength":1,"maxLength":80},{"type":"null"}]},"lat":{"anyOf":[{"type":"number","minimum":-90,"maximum":90},{"type":"null"}]},"lng":{"anyOf":[{"type":"number","minimum":-180,"maximum":180},{"type":"null"}]},"startsOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"endsOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/targets":{"get":{"tags":["targets"],"summary":"Contract delivery targets with live counters: counted, in progress, awaiting review, not started, rejected, planned and percent","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTargets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["targets"],"summary":"Set a delivery target: code, EN and AR label, unit (visit or call), the sources it counts, optional surveys, the number and the window (409 TARGET_CODE_TAKEN; 403 TARGETS_TENANT_WIDE for a branch-scoped member)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdTargets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,39}$"},"labelEn":{"type":"string","minLength":1,"maxLength":120},"labelAr":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","enum":["visit","call"]},"sources":{"minItems":1,"maxItems":3,"type":"array","items":{"type":"string","enum":["field_visits","cc_survey_responses","cati_completes"]}},"surveyIds":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"target":{"type":"integer","minimum":1,"maximum":1000000},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["code","labelEn","labelAr","unit","sources","target","startsOn","endsOn"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/targets/{targetId}":{"patch":{"tags":["targets"],"summary":"Change a target's labels, sources, surveys, number, window or status (never its code or unit)","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdTargetsTargetId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"targetId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"labelEn":{"type":"string","minLength":1,"maxLength":120},"labelAr":{"type":"string","minLength":1,"maxLength":120},"sources":{"minItems":1,"maxItems":3,"type":"array","items":{"type":"string","enum":["field_visits","cc_survey_responses","cati_completes"]}},"surveyIds":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"target":{"type":"integer","minimum":1,"maximum":1000000},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"status":{"type":"string","enum":["active","closed"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["targets"],"summary":"One target's counters, with visits per venue (visit targets), per collector (visit targets, field.manage only) and the counted items of the last 60 Riyadh days","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTargetsTargetId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"targetId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-overrides/effective/{locale}":{"get":{"tags":["wording"],"summary":"The organisation's wording for one language at start-up: platform overrides, then its own on top (empty while text overrides are off). ETag; If-None-Match answers 304. A paired wall display may read it","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextOverridesEffectiveLocale","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"locale","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"textOverrideMapSchema"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-overrides/validate":{"post":{"tags":["wording"],"summary":"Live check of a text against the shipped words of that key (length, placeholders, no HTML, no new link, banned words); stores nothing. Rate-limited per member and organisation (429 with Retry-After)","description":"Permission: `wording.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextOverridesValidate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"textOverrideValidateBody","response":"textOverrideValidateResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"key":{"type":"string","minLength":3,"maxLength":128,"pattern":"^(?!.*(?:^|\\.)(?:__proto__|constructor|prototype)(?:\\.|$))[a-z][A-Za-z0-9_]*(\\.[A-Za-z0-9_]+){1,11}$"},"locale":{"type":"string","enum":["ar","en"]},"value":{"type":"string","maxLength":2000}},"required":["key","locale","value"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-overrides/{locale}/{key}":{"get":{"tags":["wording"],"summary":"One text in one language: the organisation's override, the platform text under it and the last 50 changes","description":"Permission: `wording.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextOverridesLocaleKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"locale","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"textOverrideDetailSchema"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["wording"],"summary":"Save the organisation's text (autosave). Send the version you loaded as If-Match or expectedVersion (0 = new); a stale one is 409 with the current row. The shipped text again removes the override. Rate-limited per member and organisation (429 with Retry-After). Audited","description":"Permission: `wording.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdTextOverridesLocaleKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"locale","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"textOverridePutBody","response":"textOverrideWriteResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"value":{"type":"string","maxLength":2000},"expectedVersion":{"type":"integer","minimum":0,"maximum":2147483647}},"required":["value"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-overrides/{locale}/{key}/revert":{"post":{"tags":["wording"],"summary":"Remove the organisation's text (back to the platform or shipped text), or restore a version from its history. Rate-limited as a save. Audited","description":"Permission: `wording.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextOverridesLocaleKeyRevert","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"locale","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"textOverrideRevertBody","response":"textOverrideWriteResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"expectedVersion":{"type":"integer","minimum":0,"maximum":2147483647},"toVersion":{"type":"integer","exclusiveMinimum":0,"maximum":2147483647}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/theme":{"get":{"tags":["setup"],"summary":"The organisation's theme (font pair, text size, corners, colours) and its version (also the ETag; 0 = the Sayvara theme while none is saved)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTheme","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"tenantThemeView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"Save the theme. Send the version you loaded as If-Match or expectedVersion (0 = none saved); none is 428, a stale one 409 THEME_CHANGED with the current theme; 422 THEME_UNREADABLE with the WCAG AA issues (EN and AR reasons) when a colour pair does not read; audited","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdTheme","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"tenantThemePut","response":"tenantThemeView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts tenantThemePut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"Reset to the Sayvara theme (removes the saved theme; audited). Send the version you loaded as If-Match; none is 428, a stale one 409 THEME_CHANGED with the current theme","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"deleteV1TenantsTenantIdTheme","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"tenantThemeView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/theme/css":{"get":{"tags":["setup"],"summary":"The theme as one text/css block of --sv-* variables (light and dark) for sign-in; strong ETag, If-None-Match answers 304; Cache-Control private, no-cache (revalidated by ETag on every load). A paired wall display may read it","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdThemeCss","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/settings/test-contacts":{"get":{"tags":["setup"],"summary":"The Test contacts list for repeat tests: { items: [{ id, kind, address, label, addedAt }] }","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdSettingsTestContacts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Add a phone (E.164) or e-mail to the Test contacts list (409 test_mode_off while demo.repeat_tests is off, 409 list_full at 20, 409 duplicate); audited with the address tail only","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdSettingsTestContacts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/settings/test-contacts/{id}":{"delete":{"tags":["setup"],"summary":"Remove one address from the Test contacts list; audited with the address tail only","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdSettingsTestContactsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ivr/call-lists":{"post":{"tags":["messaging"],"summary":"Book keypad survey calls for a list of contacts, tickets, a segment, a saved audience or a CSV (ivr.manage or contacts.write). dryRun (default true) answers counts, price, cost, days and allowance; dryRun false makes the list: it needs an idempotency key (422 IVR_LIST_IDEMPOTENCY_REQUIRED), never adds a contact already on another open list of the survey (counts.onOpenList), and must fit in the voice minutes the plan has left (409 IVR_LIST_OVER_ALLOWANCE). Without the do-not-call list: 503 IVR_LIST_SUPPRESSION_UNAVAILABLE. A CSV needs contacts.write and no masked field, and is limited to 30 matches an hour per member (429)","description":"Permission: `ivr.manage`.","operationId":"postV1TenantsTenantIdIvrCallLists","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["messaging"],"summary":"Call lists, newest first (ivr.manage or contacts.write): { items, nextCursor }","description":"Permission: `ivr.manage`.","operationId":"getV1TenantsTenantIdIvrCallLists","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ivr/call-lists/{listId}":{"get":{"tags":["messaging"],"summary":"One call list with counts and progress (ivr.manage or contacts.write)","description":"Permission: `ivr.manage`.","operationId":"getV1TenantsTenantIdIvrCallListsListId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"listId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ivr/call-lists/{listId}/cancel":{"post":{"tags":["messaging"],"summary":"Cancel a call list: waiting items and booked calls that have not rung (ivr.manage or contacts.write; 409 IVR_LIST_FINISHED)","description":"Permission: `ivr.manage`.","operationId":"postV1TenantsTenantIdIvrCallListsListIdCancel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"listId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-check/{surveyId}":{"get":{"tags":["surveys"],"summary":"Pre-launch check of a survey (?version=N; default the newest version, so the open draft when there is one): findings in English and Arabic, ready when none is an error","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveyCheckSurveyId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"surveyCheckQuery","response":"surveyCheckResult"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns":{"get":{"tags":["cati"],"summary":"Phone interview campaigns of the organisation, each with calls made, completes and quota progress (permission: cati.call, cati.manage or cati.reports)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiCampaigns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiCampaignList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["cati"],"summary":"Set up a phone interview campaign from a survey (in set-up)","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiCampaigns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiCampaign"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"lang":{"default":"ar","type":"string","enum":["ar","en"]},"maxAttempts":{"default":6,"type":"integer","minimum":1,"maximum":20},"retryMinutes":{"default":{},"type":"object","propertyNames":{"type":"string","enum":["complete","partial","refused","do_not_call","callback","no_answer","busy","answering_machine","wrong_number","not_eligible","quota_full","language_barrier","failed"]},"additionalProperties":{"type":"integer","minimum":1,"maximum":10080}},"callbackGraceMinutes":{"default":15,"type":"integer","minimum":0,"maximum":1440},"recordCalls":{"default":false,"type":"boolean"}},"required":["name","surveyId"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}":{"get":{"tags":["cati"],"summary":"One phone interview campaign (permission: cati.call, cati.manage or cati.reports)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiCampaignsCampaignId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiCampaign"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["cati"],"summary":"Change a campaign: name, retry rules, or start / pause / close it","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdCatiCampaignsCampaignId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiCampaign"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"status":{"type":"string","enum":["draft","active","paused","closed"]},"maxAttempts":{"type":"integer","minimum":1,"maximum":20},"retryMinutes":{"type":"object","propertyNames":{"type":"string","enum":["complete","partial","refused","do_not_call","callback","no_answer","busy","answering_machine","wrong_number","not_eligible","quota_full","language_barrier","failed"]},"additionalProperties":{"type":"integer","minimum":1,"maximum":10080}},"callbackGraceMinutes":{"type":"integer","minimum":0,"maximum":1440},"recordCalls":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/entries":{"post":{"tags":["cati"],"summary":"Add people to the call list: contacts (the first shape), rows by source, or one kind (contact, ticket, response, whatsapp, manual) with the ids of its records. Each ticket, response or WhatsApp chat is resolved to its customer inside the member's branches; each entry records its source, the origin id and the member, and the add is audited. skippedBy counts the others by reason (already listed, do not call, not visible or not found, opted out, no phone, no linked contact)","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiCampaignsCampaignIdEntries","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiEntriesAdded"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"entries":{"minItems":1,"maxItems":5000,"type":"array","items":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","const":"contact"},"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"attrs":{"default":{},"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":64}},"priority":{"default":0,"type":"integer","minimum":-100,"maximum":100}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","const":"ticket"},"ticketId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"attrs":{"default":{},"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":64}},"priority":{"default":0,"type":"integer","minimum":-100,"maximum":100}},"required":["source","ticketId"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","const":"response"},"responseId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"attrs":{"default":{},"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":64}},"priority":{"default":0,"type":"integer","minimum":-100,"maximum":100}},"required":["source","responseId"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","const":"whatsapp"},"conversationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"attrs":{"default":{},"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":64}},"priority":{"default":0,"type":"integer","minimum":-100,"maximum":100}},"required":["source","conversationId"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","const":"manual"},"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"attrs":{"default":{},"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":64}},"priority":{"default":0,"type":"integer","minimum":-100,"maximum":100}},"required":["source","contactId"],"additionalProperties":false}]}}},"required":["entries"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["contact","ticket","response","whatsapp","manual"]},"ids":{"minItems":1,"maxItems":5000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"attrs":{"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":64}},"priority":{"type":"integer","minimum":-100,"maximum":100}},"required":["kind","ids"],"additionalProperties":false}]}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["cati"],"summary":"The call list, newest first, with each person's source, origin id, who added them and when, inside the member's branches. Numbers show the last four digits only (no digits with a masked phone field). Each page is recorded as a contact view. 400 BAD_CURSOR for a cursor that is not valid.","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiCampaignsCampaignIdEntries","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"catiEntriesQuery","response":"catiEntryPage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/entries/import":{"post":{"tags":["cati"],"summary":"Check (dry run, the default) or import a call list of phone numbers; each number is matched to a contact, opt-outs and unknown numbers are left out (also needs contacts.write: 403 CATI_LIST_NEEDS_CONTACTS)","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiCampaignsCampaignIdEntriesImport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiListImportResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"csv":{"type":"string","minLength":1,"maxLength":2097152},"dryRun":{"default":true,"type":"boolean"},"defaultCountry":{"default":"SA","type":"string","enum":["SA","AE","KW","BH","QA","OM"]}},"required":["csv"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/quotas":{"get":{"tags":["cati"],"summary":"The quota cells with what they match, and the attribute values on the call list","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiCampaignsCampaignIdQuotas","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiQuotaList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["cati"],"summary":"Replace the quota cells (targets per group)","description":"Permission: `cati.manage`.","operationId":"putV1TenantsTenantIdCatiCampaignsCampaignIdQuotas","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"cells":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":100},"match":{"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":64}},"target":{"type":"integer","minimum":1,"maximum":1000000}},"required":["label","match","target"],"additionalProperties":false}}},"required":["cells"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/callers":{"put":{"tags":["cati"],"summary":"Replace who calls on this campaign, and pause or resume a caller","description":"Permission: `cati.manage`.","operationId":"putV1TenantsTenantIdCatiCampaignsCampaignIdCallers","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"callers":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"userId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"paused":{"default":false,"type":"boolean"}},"required":["userId"],"additionalProperties":false}}},"required":["callers"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/report":{"get":{"tags":["cati"],"summary":"Campaign report: rates, call results, quotas and callers (from an optional date): data, a CSV file or the print page (save as PDF), in Arabic or English; each file is audited","description":"Permission: `cati.reports`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiCampaignsCampaignIdReport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"name":"format","in":"query","required":false,"schema":{"default":"json","type":"string","enum":["json","csv","html"]}},{"name":"lang","in":"query","required":false,"schema":{"default":"ar","type":"string","enum":["ar","en"]}}],"x-sayvara-contract":{"response":"catiReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/next":{"post":{"tags":["cati"],"summary":"Take the next person due for the signed-in caller (callbacks first); never a phone number","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiCampaignsCampaignIdNext","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiNext"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/attempts":{"post":{"tags":["cati"],"summary":"Record what happened on the call; the person moves on (retry, callback, done)","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiEntriesEntryIdAttempts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiAttemptResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"outcome":{"type":"string","enum":["complete","partial","refused","do_not_call","callback","no_answer","busy","answering_machine","wrong_number","not_eligible","quota_full","language_barrier","failed"]},"startedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"durationSeconds":{"type":"integer","minimum":0,"maximum":86400},"callbackAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"sameCaller":{"default":false,"type":"boolean"},"callId":{"type":"string","minLength":1,"maxLength":128},"bridgeCallId":{"type":"string","minLength":1,"maxLength":128},"interviewId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["outcome","startedAt"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/release":{"post":{"tags":["cati"],"summary":"Give the person back without a call","description":"Permission: `cati.call`.","operationId":"postV1TenantsTenantIdCatiEntriesEntryIdRelease","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys":{"get":{"tags":["journeys"],"summary":"Journey maps of the organisation (archived ones with include=all)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","required":false,"schema":{"default":"current","type":"string","enum":["current","all"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["journeys"],"summary":"Draw a journey map, or start one from a ready journey (in set-up)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdJourneys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"templateKey":{"type":"string","enum":["book_facility","buy_ticket","register_club","apply_licence"]}},"required":["templateKey"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":120},"en":{"type":"string","maxLength":120}},"additionalProperties":false},"description":{"type":"object","properties":{"ar":{"type":"string","maxLength":500},"en":{"type":"string","maxLength":500}},"additionalProperties":false},"stages":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":120},"en":{"type":"string","maxLength":120}},"additionalProperties":false},"goal":{"type":"object","properties":{"ar":{"type":"string","maxLength":500},"en":{"type":"string","maxLength":500}},"additionalProperties":false},"metric":{"type":"string","enum":["nps","csat","ces"]},"touchpoints":{"maxItems":12,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":120},"en":{"type":"string","maxLength":120}},"additionalProperties":false},"channel":{"type":"string","enum":["whatsapp","sms","email","web","phone","in_person","app","kiosk"]}},"required":["id","name","channel"],"additionalProperties":false}},"links":{"type":"object","properties":{"surveyIds":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"channels":{"maxItems":50,"type":"array","items":{"type":"string","enum":["whatsapp","sms","email","web","phone","in_person","app","kiosk"]}},"branchIds":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"ticketTypes":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"wrapUpIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"helpdeskGroupIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$"}},"helpdeskTags":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}}},"required":["surveyIds","channels","branchIds","ticketTypes"],"additionalProperties":false},"ownerId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id","name","metric","touchpoints","links"],"additionalProperties":false}}},"required":["name","stages"],"additionalProperties":false}]}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/templates":{"get":{"tags":["journeys"],"summary":"Ready journeys to start from, in Arabic and English","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysTemplates","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/suggested-stages":{"get":{"tags":["journeys"],"summary":"Stages suggested from your own surveys, for one map or a new one (AI grouping when on, else by their words)","description":"Permission: `surveys.write`.","operationId":"getV1TenantsTenantIdJourneysSuggestedStages","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/units":{"get":{"tags":["journeys"],"summary":"Org units in your scope that a branch comparison can pick, in Arabic and English","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysUnits","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}":{"get":{"tags":["journeys"],"summary":"One journey map with its stages, touchpoints, links and the names of its stage owners","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysJourneyId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["journeys"],"summary":"Save the whole map; send the version you loaded (409 when someone saved since)","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdJourneysJourneyId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":120},"en":{"type":"string","maxLength":120}},"additionalProperties":false},"description":{"type":"object","properties":{"ar":{"type":"string","maxLength":500},"en":{"type":"string","maxLength":500}},"additionalProperties":false},"stages":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":120},"en":{"type":"string","maxLength":120}},"additionalProperties":false},"goal":{"type":"object","properties":{"ar":{"type":"string","maxLength":500},"en":{"type":"string","maxLength":500}},"additionalProperties":false},"metric":{"type":"string","enum":["nps","csat","ces"]},"touchpoints":{"maxItems":12,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":120},"en":{"type":"string","maxLength":120}},"additionalProperties":false},"channel":{"type":"string","enum":["whatsapp","sms","email","web","phone","in_person","app","kiosk"]}},"required":["id","name","channel"],"additionalProperties":false}},"links":{"type":"object","properties":{"surveyIds":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"channels":{"maxItems":50,"type":"array","items":{"type":"string","enum":["whatsapp","sms","email","web","phone","in_person","app","kiosk"]}},"branchIds":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"ticketTypes":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"wrapUpIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"helpdeskGroupIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:-]+$"}},"helpdeskTags":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}}},"required":["surveyIds","channels","branchIds","ticketTypes"],"additionalProperties":false},"ownerId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id","name","metric","touchpoints","links"],"additionalProperties":false}},"version":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["name","stages","version"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["journeys"],"summary":"Activate or archive a map, or turn its stage drop alerts on or off","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdJourneysJourneyId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"status":{"type":"string","enum":["draft","active","archived"]},"alertsOn":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}/alerts":{"get":{"tags":["journeys"],"summary":"Stage drop alerts of a map, newest day first (from an optional date)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysJourneyIdAlerts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}/scores":{"get":{"tags":["journeys"],"summary":"Score, answers, reach and drop-off per stage over Riyadh days (a score needs 5 answers)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysJourneyIdScores","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}/compare":{"get":{"tags":["journeys"],"summary":"Compare two periods of the map, the map with another map, or two branches, stage by stage","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysJourneyIdCompare","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"vsFrom","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"vsTo","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"vsJourney","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"vsOrgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/customers/{contactId}/timeline":{"get":{"tags":["journeys"],"summary":"One customer's timeline, newest first: survey answers, tickets, phone interview and other calls, contact-centre conversations, linked reviews and DM threads (sources still coming are listed)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdJourneysCustomersContactIdTimeline","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512}},{"name":"limit","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/improvement/projects":{"get":{"tags":["journeys"],"summary":"Improvement projects you can see (optionally one status)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysImprovementProjects","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["planned","active","done","cancelled"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["journeys"],"summary":"Start an improvement project: owner, dates, goal metric, units, themes and tickets","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdJourneysImprovementProjects","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"ownerId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["planned","active","done","cancelled"]},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endsOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"metric":{"type":"string","enum":["nps","csat","ces"]},"goalTarget":{"type":["number","null"]},"unitIds":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"themes":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"ticketIds":{"maxItems":200,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["name","ownerId","startsOn","metric"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/improvement/projects/{projectId}":{"get":{"tags":["journeys"],"summary":"One improvement project with a summary of its tickets","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysImprovementProjectsProjectId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["journeys"],"summary":"Change a project; send the version you loaded (409 when someone saved since)","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdJourneysImprovementProjectsProjectId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"ownerId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["planned","active","done","cancelled"]},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endsOn":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"metric":{"type":"string","enum":["nps","csat","ces"]},"goalTarget":{"type":["number","null"]},"unitIds":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"themes":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"version":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["version"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/improvement/projects/{projectId}/tickets":{"post":{"tags":["journeys"],"summary":"Group more tickets into the project","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdJourneysImprovementProjectsProjectIdTickets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"ticketIds":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["ticketIds"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/improvement/projects/{projectId}/tickets/{ticketId}":{"delete":{"tags":["journeys"],"summary":"Take a ticket out of the project","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdJourneysImprovementProjectsProjectIdTicketsTicketId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/improvement/projects/{projectId}/impact":{"get":{"tags":["journeys"],"summary":"Scores before and after the project, with the method and a significance test (small groups hidden)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysImprovementProjectsProjectIdImpact","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"projectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}/pain-points":{"get":{"tags":["journeys"],"summary":"Pain points (ticket causes, negative comment themes) and opportunities per stage over Riyadh days","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysJourneyIdPainPoints","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}/changes":{"get":{"tags":["journeys"],"summary":"Has anything the map counts (answers, tickets, contact-centre conversations, help-desk closes, CRM case and incident closes) changed since the cursor, ccSince and ccMark? Poll with the returned values (starts now without them)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdJourneysJourneyIdChanges","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512}},{"name":"ccSince","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},{"name":"ccMark","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{1,7}\\.[A-Za-z0-9_-]{22}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}/live":{"get":{"tags":["journeys"],"summary":"The change check pushed (text/event-stream): ready, check after every server check (changed or not), reset when the check starts over; ping every 25 s, ended after 15 minutes (reconnect); at most 4 streams per member; GET changes is the polling fallback","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdJourneysJourneyIdLive","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"journeyLiveEvent"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}/export":{"get":{"tags":["journeys"],"summary":"The map with its stage scores in one language: the snapshot (json, also for a PNG drawn in the browser), a print page for PDF (html) or a PowerPoint deck (pptx); files are audited (journeys.export)","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdJourneysJourneyIdExport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"format","in":"query","required":false,"schema":{"default":"json","type":"string","enum":["json","html","pptx"]}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}/shares":{"get":{"tags":["journeys"],"summary":"Read-only links of the map, newest first, with expiry, revocation and views (never the token)","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdJourneysJourneyIdShares","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["journeys"],"summary":"A read-only link to the map and its scores as they are now, open for 1 to 90 days; the token is in this answer only (409 JOURNEY_SHARE_LIMIT past 20 open links)","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdJourneysJourneyIdShares","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"expiresInDays":{"default":14,"type":"integer","minimum":1,"maximum":90},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/{journeyId}/shares/{shareId}/revoke":{"post":{"tags":["journeys"],"summary":"Stop a read-only link at once","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdJourneysJourneyIdSharesShareIdRevoke","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"journeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"shareId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/journeys/shared/open":{"post":{"tags":["journeys"],"summary":"Open a read-only journey link without signing in (token in the body): the snapshot and its expiry, or found false for any link that does not open; rate limited per client and link","operationId":"postV1TenantsTenantIdJourneysSharedOpen","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","pattern":"^[A-Za-z0-9_-]{32}$"}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/pulses":{"get":{"tags":["ex"],"summary":"Employee pulses of the organisation (archived ones with include=all)","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdExPulses","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","all"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["ex"],"summary":"Set up an employee pulse (not started), from the ready one or written in full","description":"Permission: `members.write`.","operationId":"postV1TenantsTenantIdExPulses","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"template":{"type":"string","const":"default"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false}},"required":["template"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false},"enpsText":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false},"items":{"maxItems":8,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"text":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false}},"required":["key","text"],"additionalProperties":false}},"audienceUnitIds":{"maxItems":200,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"schedule":{"type":"object","properties":{"cadence":{"type":"string","enum":["once","monthly","quarterly"]},"openDay":{"type":"integer","minimum":1,"maximum":28},"openDays":{"type":"integer","minimum":2,"maximum":21},"startOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["cadence","openDay","openDays"],"additionalProperties":false},"minGroup":{"type":"integer","minimum":5,"maximum":50}},"required":["name","enpsText","items","audienceUnitIds","schedule","minGroup"],"additionalProperties":false}]}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/pulses/template":{"get":{"tags":["ex"],"summary":"The ready pulse: eNPS and five statements in Arabic and English","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdExPulsesTemplate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/pulses/{pulseId}":{"get":{"tags":["ex"],"summary":"One employee pulse","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdExPulsesPulseId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"pulseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["ex"],"summary":"Save the whole pulse; send the version you loaded (409 when someone saved since)","description":"Permission: `members.write`.","operationId":"putV1TenantsTenantIdExPulsesPulseId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"pulseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false},"enpsText":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false},"items":{"maxItems":8,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"text":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false}},"required":["key","text"],"additionalProperties":false}},"audienceUnitIds":{"maxItems":200,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"schedule":{"type":"object","properties":{"cadence":{"type":"string","enum":["once","monthly","quarterly"]},"openDay":{"type":"integer","minimum":1,"maximum":28},"openDays":{"type":"integer","minimum":2,"maximum":21},"startOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["cadence","openDay","openDays"],"additionalProperties":false},"minGroup":{"type":"integer","minimum":5,"maximum":50},"version":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["name","enpsText","items","audienceUnitIds","schedule","minGroup","version"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["ex"],"summary":"Start, pause, resume or archive a pulse","description":"Permission: `members.write`.","operationId":"patchV1TenantsTenantIdExPulsesPulseId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"pulseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"status":{"type":"string","enum":["draft","active","paused","archived"]}},"required":["status"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/pulses/{pulseId}/runs":{"get":{"tags":["ex"],"summary":"The runs of a pulse (one per period), newest first","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdExPulsesPulseIdRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"pulseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/runs/{runId}/results":{"get":{"tags":["ex"],"summary":"eNPS and item scores per org unit, once the run has closed (released=false and releasesAt before then); groups under the minimum, and groups subtraction would reveal, are hidden","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdExRunsRunIdResults","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/answer/form":{"post":{"tags":["ex"],"summary":"The questions behind a one-time staff answer link (token in the body)","operationId":"postV1TenantsTenantIdExAnswerForm","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","minLength":16,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/answer":{"post":{"tags":["ex"],"summary":"Answer a pulse once with the one-time link; nothing about the person is stored with the answer","operationId":"postV1TenantsTenantIdExAnswer","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","minLength":16,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"},"enps":{"anyOf":[{"type":"number"},{"type":"string","maxLength":4}]},"items":{"type":"object","propertyNames":{"type":"string","maxLength":32},"additionalProperties":{"anyOf":[{"type":"number"},{"type":"string","maxLength":4}]}}},"required":["token","enps","items"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/themes":{"get":{"tags":["text-analytics"],"summary":"Keywords, comment groups and the sentiment of each theme in a date range","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsThemes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/trends":{"get":{"tags":["text-analytics"],"summary":"Theme counts per period, and new, rising and falling themes against the period before","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsTrends","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"granularity","in":"query","required":false,"schema":{"default":"week","type":"string","enum":["day","week","month"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/root-cause":{"get":{"tags":["text-analytics"],"summary":"Themes behind low scores ranked by score points lost, their likely cause, where they cost the most, with masked quotes","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsRootCause","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/emotions":{"get":{"tags":["text-analytics"],"summary":"Emotion, intent and urgency counts, with masked quotes of urgent comments","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsEmotions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/dialects":{"get":{"tags":["text-analytics"],"summary":"Arabic dialects, Arabizi and mixed-language comments","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsDialects","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/cards":{"get":{"tags":["text-analytics"],"summary":"Ranked insight cards with evidence and masked quotes","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsCards","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"max","in":"query","required":false,"schema":{"default":8,"type":"integer","minimum":1,"maximum":20}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask":{"post":{"tags":["text-analytics"],"summary":"Ask Sayvara (AI-06): a question in Arabic or English answered with computed numbers, a chart spec and masked quotes (429 RATE_LIMITED over 20 questions a minute or 200 a day per person, `details.window` minute or day). Optional `sessionId` adds the question to one of the caller’s conversations (404 when not theirs, 409 at 100 turns); without it a new one starts. Kept for the asker only: the question masked, the answer without quote text","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsAsk","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"askRequestSchema + taAskSessionRef","response":"taAskReply"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts askRequestSchema + taAskSessionRef"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask/stream":{"post":{"tags":["text-analytics"],"summary":"Ask Sayvara in stages (text/event-stream): the same body, permission, question budget and conversation checks as POST ask (a refusal before the first event is the usual JSON error); events plan (the checked plan, sources, windows), facts (computed facts, base and the chart drawn from them), wording (the whole ask reply, its wording through the number check), or error ({ status, code, message, details }) after the first event; ping every 25 s","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsAskStream","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"askRequestSchema + taAskSessionRef","response":"taAskStreamEvent"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts askRequestSchema + taAskSessionRef"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask/sessions":{"get":{"tags":["text-analytics"],"summary":"The caller’s own Ask Sayvara conversations, newest first (at most 50; one idle for 90 days is gone)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsAskSessions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taAnalystSessions"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask/sessions/{sessionId}":{"get":{"tags":["text-analytics"],"summary":"One of the caller’s conversations with its turns: masked questions and stored answers (quotes by response id only); 404 when not theirs","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsAskSessionsSessionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taAnalystSession"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["text-analytics"],"summary":"Delete one of the caller’s conversations with its turns (404 when not theirs); audited without the question","description":"Permission: `dashboards.read`.","operationId":"deleteV1TenantsTenantIdTextAnalyticsAskSessionsSessionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask/whatsapp":{"get":{"tags":["text-analytics"],"summary":"Answers on WhatsApp (AI-06): whether the signed-in member turned them on (off by default), whether the organisation offers them (`available`), whether their WhatsApp number is verified (last 4 digits only) and still `fresh`, and the days a verification counts (`freshDays`, 90)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsAskWhatsapp","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["text-analytics"],"summary":"Turn answers on WhatsApp on or off for the signed-in member only; 409 `WHATSAPP_DOOR_UNAVAILABLE` or `PHONE_NOT_VERIFIED` to turn them on (off always works); audited","description":"Permission: `dashboards.read`.","operationId":"putV1TenantsTenantIdTextAnalyticsAskWhatsapp","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"on":{"type":"boolean"}},"required":["on"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask/whatsapp/code":{"post":{"tags":["text-analytics"],"summary":"Send a one-time code on WhatsApp to `phone` (E.164) or the signed-in member’s verified number, to confirm it for answers on WhatsApp; 409 `PHONE_NOT_VERIFIED` (no number) or `WHATSAPP_DOOR_UNAVAILABLE`; the WhatsApp code limits apply","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdTextAnalyticsAskWhatsappCode","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"phone":{"type":"string","pattern":"^\\+[1-9]\\d{6,14}$"}},"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask/whatsapp/confirm":{"post":{"tags":["text-analytics"],"summary":"Confirm the WhatsApp number with its code (400 `INVALID_MFA_CODE`): the 90 days start over; the session cookie is renewed","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdTextAnalyticsAskWhatsappConfirm","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["code"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/digest":{"get":{"tags":["text-analytics"],"summary":"This period against the last one (default: the last full week), with the top cards","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsDigest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/digest/summary":{"get":{"tags":["text-analytics"],"summary":"Weekly AI summary (AI-04): what changed, why and what to do, each point citing the replies behind it (masked); AI words it from the computed numbers only, else computed words (`ai.status`)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsDigestSummary","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["ar","en"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/weekly-summary/subscription":{"get":{"tags":["text-analytics"],"summary":"Summary email (AI-04): whether the signed-in member gets it, its cadence (`weekly` or `daily`), their weekday (0 = Sunday) and hour in the organisation's time; `available` is false while the weekly job does not run, `dailyAvailable` while the daily email cannot be sent","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsWeeklySummarySubscription","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["text-analytics"],"summary":"Turn the summary email on or off for the signed-in member only, weekly at a weekday and hour or daily at an hour (computed figures and topic names, no customer words); 409 `DAILY_EMAIL_UNAVAILABLE` for daily while it cannot be sent; audited","description":"Permission: `dashboards.read`.","operationId":"putV1TenantsTenantIdTextAnalyticsWeeklySummarySubscription","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"subscribed":{"type":"boolean"},"weekday":{"type":"integer","minimum":0,"maximum":6},"sendHour":{"type":"integer","minimum":0,"maximum":23},"cadence":{"default":"weekly","type":"string","enum":["weekly","daily"]}},"required":["subscribed","weekday","sendHour"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/signals":{"get":{"tags":["text-analytics"],"summary":"Experience signals per reply: effort, urgency, churn risk, intent and emotion counts, with masked quotes","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsSignals","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/mentions":{"get":{"tags":["text-analytics"],"summary":"Which branches, staff roles, service areas and catalogue entries (products, brands, other) comments are about, with the tone of each","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsMentions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["branch","employee","product","service","brand","other"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/repeats":{"get":{"tags":["text-analytics"],"summary":"Repeat complaints: the same contact raising the same issue again within a window","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsRepeats","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"windowDays","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":1,"maximum":365}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/library":{"get":{"tags":["text-analytics"],"summary":"The Saudi industry theme library: government services, banking, health, telecom and retail","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsLibrary","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/library/{industry}":{"get":{"tags":["text-analytics"],"summary":"One industry pack: headings and themes with Arabic and English labels, phrases and examples","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsLibraryIndustry","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"industry","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/library-set":{"get":{"tags":["text-analytics"],"summary":"A starting theme set from chosen industries: themes, review catalogue and classify labels","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsLibrarySet","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"industries","in":"query","required":true,"schema":{"type":"string","maxLength":2000}},{"name":"exclude","in":"query","required":false,"schema":{"type":"string","maxLength":2000}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["ar","en"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/library-preview":{"get":{"tags":["text-analytics"],"summary":"What the chosen industry themes would tag in a date range, and existing themes that merge into them","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsLibraryPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"industries","in":"query","required":true,"schema":{"type":"string","maxLength":2000}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/explain":{"get":{"tags":["text-analytics"],"summary":"Why a chart point or range moved: themes, branches, channels and surveys, with masked replies behind it","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsExplain","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"metric","in":"query","required":true,"schema":{"type":"string","enum":["nps","csat","ces","negative_share","theme"]}},{"name":"theme","in":"query","required":false,"schema":{"type":"string","pattern":"^[\\p{L}\\p{N}_]{1,64}$"}},{"name":"baselineFrom","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"baselineTo","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"channel","in":"query","required":false,"schema":{"type":"string","pattern":"^[a-z0-9_-]{1,32}$"}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["ar","en"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/agent/policy":{"get":{"tags":["text-analytics"],"summary":"The Resolve Agent (Add-on, available on request) policy: the stored one, or the default with the agent off","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsAgentPolicy","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["text-analytics"],"summary":"Save the Resolve Agent (Add-on, available on request) policy: enabled (default false), tone (style, languages, defaultLang, apology, signOff, aiDrafts), remedies (voucher or discount with a cap, free item, redo, refund review; offers the tenant fulfils), callback slots (days, from, to, capacity, lead time, horizon), handover topics (legal, medical, safety, threat, VIP list, own keywords) and anger threshold, forbidden phrases, limits (turns, failures, remedies per contact over a window) and approval (auto-send low-risk templates; never when regulated). 03-2 / CL-07: when the organisation needs approval for AI auto-reply rules (approvals policy kind ai.auto_reply), nothing is saved until it is approved: 202 pending_approval { outcome, approvalId }, applied when another member approves","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdTextAnalyticsAgentPolicy","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["text-analytics"],"summary":"Remove the Resolve Agent policy: the agent is off again; 404 when none is stored. With approval needed for AI auto-reply rules (kind ai.auto_reply): 202 pending_approval, removed when another member approves","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdTextAnalyticsAgentPolicy","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/agent/simulate":{"post":{"tags":["text-analytics"],"summary":"Test a policy (sent, else the stored one, as if enabled) against a scripted conversation of up to 40 customer messages, each with an optional scripted model proposal: every guardrail decision and reply; no model is called and nothing is stored","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdTextAnalyticsAgentSimulate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"policy":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"start":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"messages":{"minItems":1,"maxItems":40,"type":"array","items":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":2000},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"proposal":{}},"required":["text"],"additionalProperties":false}}},"required":["messages"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/agent/conversations":{"get":{"tags":["text-analytics"],"summary":"The agent's WhatsApp conversations, newest first, by status or with replies waiting for a person (whole-organisation access)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsAgentConversations","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","handed_over","closed"]}},{"name":"pending","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}},{"name":"before","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/agent/conversations/{conversationId}":{"get":{"tags":["text-analytics"],"summary":"One agent conversation with every turn: the masked customer message, the model input reference, the proposal, the guardrail decision and reasons, the reply and its approval (whole-organisation access)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsAgentConversationsConversationId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"conversationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/agent/conversations/{conversationId}/takeover":{"post":{"tags":["text-analytics"],"summary":"Take the conversation over: the agent stays silent in it from now on","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsAgentConversationsConversationIdTakeover","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"conversationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/agent/conversations/{conversationId}/turns/{turnId}/approve":{"post":{"tags":["text-analytics"],"summary":"Approve a reply waiting for a person and send it on WhatsApp inside the customer's 24-hour session window (409 OUTSIDE_SESSION_WINDOW otherwise, the reply stays pending; 409 CONFLICT when taken over, superseded or already decided; 409 SLOT_FULL when the call-back time is full; 403 ENTITLEMENT_REQUIRED when read-only)","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsAgentConversationsConversationIdTurnsTurnIdApprove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"conversationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"turnId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/agent/conversations/{conversationId}/turns/{turnId}/reject":{"post":{"tags":["text-analytics"],"summary":"Reject a reply waiting for a person: nothing is sent","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsAgentConversationsConversationIdTurnsTurnIdReject","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"conversationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"turnId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/themes/review":{"get":{"tags":["text-analytics"],"summary":"Every theme decision of the organisation (approve, rename, merge or hide), who made it and when, and whether new themes count before approval","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsThemesReview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taThemeDecisions"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/themes/review/settings":{"put":{"tags":["text-analytics"],"summary":"Count new themes before a person approves them (off by default: a new theme counts only once approved; organisation-wide access)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdTextAnalyticsThemesReviewSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taThemeCounting"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"countOpen":{"type":"boolean"}},"required":["countOpen"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/themes/{theme}/review":{"put":{"tags":["text-analytics"],"summary":"Approve, rename, merge or hide a theme for the whole organisation (organisation-wide access; 409 TEXT_ANALYTICS_MERGE_LOOP for a merge that loops); every theme and sentiment report applies it","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdTextAnalyticsThemesThemeReview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"theme","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taThemeDecision"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","oneOf":[{"type":"object","properties":{"action":{"type":"string","const":"approve"}},"required":["action"],"additionalProperties":false},{"type":"object","properties":{"action":{"type":"string","const":"hide"}},"required":["action"],"additionalProperties":false},{"type":"object","properties":{"action":{"type":"string","const":"rename"},"labelEn":{"type":"string","minLength":1,"maxLength":80},"labelAr":{"type":"string","minLength":1,"maxLength":80}},"required":["action"],"additionalProperties":false},{"type":"object","properties":{"action":{"type":"string","const":"merge"},"into":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[\\p{Ll}\\p{Lo}\\p{N}_-]+$"}},"required":["action","into"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["text-analytics"],"summary":"Put a theme back to review: its earlier decision no longer applies (404 when there was none)","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdTextAnalyticsThemesThemeReview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"theme","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/themes/{theme}/comments":{"get":{"tags":["text-analytics"],"summary":"The newest 20 masked comments in a date range that carry a theme after review, with their themes and sentiment","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsThemesThemeComments","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"theme","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"x-sayvara-contract":{"response":"taThemeComments"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/responses/{responseId}/tags":{"post":{"tags":["text-analytics"],"summary":"Correct one comment's tags in the caller's scope: add, remove or replace themes and/or set the sentiment; answers the tags after review","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsResponsesResponseIdTags","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"responseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"add":{"maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[\\p{Ll}\\p{Lo}\\p{N}_-]+$"}},"remove":{"maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[\\p{Ll}\\p{Lo}\\p{N}_-]+$"}},"replace":{"type":"object","properties":{"from":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[\\p{Ll}\\p{Lo}\\p{N}_-]+$"},"to":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[\\p{Ll}\\p{Lo}\\p{N}_-]+$"}},"required":["from","to"],"additionalProperties":false},"sentiment":{"type":"string","enum":["positive","neutral","negative"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/library-choice":{"get":{"tags":["text-analytics"],"summary":"The industry theme packs the organisation uses (AI-09), and how many of each pack's own themes are in use","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsLibraryChoice","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taLibraryChoice"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["text-analytics"],"summary":"Set the industry theme packs in use (organisation-wide access): approves the themes of chosen packs that have no decision and drops the plain approvals of packs no longer chosen","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdTextAnalyticsLibraryChoice","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taLibraryChoiceSaved"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"industries":{"maxItems":5,"type":"array","items":{"type":"string","enum":["government","banking","health","telecom","retail"]}}},"required":["industries"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/held-out/sample":{"get":{"tags":["text-analytics"],"summary":"Unlabelled responses of a date range to label next (masked excerpts only, never the analysis' reading), spread over the dialects with the fewest labels; the topic choices and the label counts","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsHeldOutSample","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"size","in":"query","required":false,"schema":{"default":12,"type":"integer","minimum":1,"maximum":50}},{"name":"round","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":0,"maximum":10000}}],"x-sayvara-contract":{"response":"taHeldOutSample"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/held-out/labels/{responseId}":{"put":{"tags":["text-analytics"],"summary":"Record or replace the true dialect, Arabizi and mixed flags, topic and mood of one response with a comment in the caller's scope (404 otherwise); audited","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdTextAnalyticsHeldOutLabelsResponseId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"responseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taHeldOutLabel"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"dialect":{"type":"string","enum":["najdi","hijazi","gulf","egyptian","levantine","msa","english","unknown"]},"arabizi":{"type":"boolean"},"codeMixed":{"type":"boolean"},"topic":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[\\p{Ll}\\p{Lo}\\p{N}_-]+$"},"mood":{"type":"string","enum":["positive","neutral","negative"]}},"required":["dialect","arabizi","codeMixed","topic","mood"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["text-analytics"],"summary":"Remove the label of one response (404 when there was none); audited","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdTextAnalyticsHeldOutLabelsResponseId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"responseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/held-out/accuracy":{"get":{"tags":["text-analytics"],"summary":"Accuracy per dialect of dialect detection, topic and mood on the newest 600 labels, with Wilson intervals, precision, recall, F1, support and confusion; no figure below the minimum base","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsHeldOutAccuracy","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taHeldOutAccuracy"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/anomalies":{"get":{"tags":["text-analytics"],"summary":"What changed: unusual days the daily check found (score drops, negative spikes, new or rising themes, response drops), newest first, each with severity, metric, period and a headline in English or Arabic; a member scoped to branches sees only those branches' findings (400 VALIDATION_FAILED for a range over 92 days)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsAnomalies","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"limit","in":"query","required":false,"schema":{"default":10,"type":"integer","minimum":1,"maximum":50}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}}],"x-sayvara-contract":{"response":"taAnomalies"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/cards/recipients":{"get":{"tags":["text-analytics"],"summary":"Who may be told about an insight card: active members who read dashboards and whose scope covers the card","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsCardsRecipients","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"x-sayvara-contract":{"response":"taCardRecipients"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/cards/notify":{"post":{"tags":["text-analytics"],"summary":"Tell one member about one insight card (staff message, WhatsApp then email; once per card, period and member). 404 TA_CARD_GONE when the card is not in this period and scope, 400 TA_CARD_RECIPIENT for a member who may not be told","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsCardsNotify","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taCardNotified"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"from":{"type":"string","maxLength":40},"to":{"type":"string","maxLength":40},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"cardId":{"type":"string","minLength":3,"maxLength":200},"memberId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["cardId","memberId"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/cards/ticket":{"post":{"tags":["text-analytics"],"summary":"Open one closed-loop ticket for one insight card through the ticket intake (once per card, period and filter). 404 TA_CARD_GONE when the card is not in this period and scope, 403 TA_CARD_TICKET_NOT_ENTITLED without ticket intake in the plan, 503 TA_CARD_TICKET_UNAVAILABLE when tickets cannot be opened, 429 RATE_LIMITED over 20 a minute","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsCardsTicket","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taCardTicketOpened"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"from":{"type":"string","maxLength":40},"to":{"type":"string","maxLength":40},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"cardId":{"type":"string","minLength":3,"maxLength":200}},"required":["cardId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask/tv/walls":{"get":{"tags":["text-analytics"],"summary":"The caller’s own wall dashboards (dashboards marked for wall screens) with the period each shows, most recently changed first; with sessionId and turn, each says whether it fits that stored answer (the same period and comparison)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsAskTvWalls","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"taAskTvWallsQuery","response":"taAskTvWalls"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask/tv":{"post":{"tags":["text-analytics"],"summary":"Show an Ask answer on a wall screen: its widget, sized for a wall, saved on one of the caller’s wall dashboards or a new one. Saved only with `confirm: true` (400 confirm_required); the widget comes from the caller’s stored turn (404 when not theirs), refused by name as a dashboard pin is (400), 409 wall_full at the widget limit, 409 wall_locked when the dashboard builder keeps the wall’s layout, 409 period_differs when the wall shows another period or comparison; audited when something is saved","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsAskTv","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"taAskTvBody","response":"taAskTvSaved"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts taAskTvBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/ask/tv/walls/{dashboardId}/display":{"get":{"tags":["text-analytics"],"summary":"One wall dashboard (a dashboard marked for wall screens) with its chart results, for the wall screen: a paired TV display with the Ask panel reads any wall of its tenant (403 DISPLAY_PANEL_NOT_ALLOWED without it), a signed-in member a wall they may view; results in the caller’s own scope at the wall’s period, only the chart kinds an Ask answer can show, aggregate figures only; 404 for a wall the caller may not read","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsAskTvWallsDashboardIdDisplay","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taAskTvDisplay"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/drivers":{"get":{"tags":["stats"],"summary":"Key drivers of the score with what-if gains and the importance-performance quadrant","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsDrivers","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"offsetMinutes","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":-720,"maximum":840}},{"name":"quality","in":"query","required":false,"schema":{"default":"all","type":"string","enum":["all","exclude_flagged","only_flagged"]}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}},{"name":"source","in":"query","required":false,"schema":{"default":"questions","type":"string","enum":["questions","themes"]}},{"name":"delta","in":"query","required":false,"schema":{"type":"number","minimum":-10,"maximum":10}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/drivers/by-group":{"get":{"tags":["stats"],"summary":"Key drivers per branch, channel, stage or other group, with each group's top driver","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsDriversByGroup","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"offsetMinutes","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":-720,"maximum":840}},{"name":"quality","in":"query","required":false,"schema":{"default":"all","type":"string","enum":["all","exclude_flagged","only_flagged"]}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}},{"name":"source","in":"query","required":false,"schema":{"default":"questions","type":"string","enum":["questions","themes"]}},{"name":"by","in":"query","required":false,"schema":{"default":"orgUnit","anyOf":[{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},{"type":"string","pattern":"^level:(region|branch|team)$"},{"type":"string","pattern":"^stage:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"}]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/crosstab":{"post":{"tags":["stats"],"summary":"Cross-tab with column letters for significant differences, a chi-square test and optional rim weights","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdStatsCrosstab","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"filters":{"default":{"offsetMinutes":0,"quality":"all"},"type":"object","properties":{"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"offsetMinutes":{"default":0,"type":"integer","minimum":-720,"maximum":840},"quality":{"default":"all","type":"string","enum":["all","exclude_flagged","only_flagged"]}},"additionalProperties":false},"rows":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"cols":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"confidence":{"default":0.95,"type":"number"},"correction":{"default":"holm","type":"string","enum":["none","bonferroni","holm","bh"]},"lang":{"default":"en","type":"string","enum":["en","ar"]},"weighting":{"type":"object","properties":{"targets":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"dimension":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"shares":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":128},"additionalProperties":{"type":"number","minimum":0,"maximum":1000000000}}},"required":["dimension","shares"],"additionalProperties":false}},"trim":{"type":"object","properties":{"min":{"type":"number","minimum":0.01,"maximum":1},"max":{"type":"number","minimum":1,"maximum":100}},"required":["min","max"],"additionalProperties":false},"maxIterations":{"type":"integer","minimum":1,"maximum":200}},"required":["targets"],"additionalProperties":false}},"required":["rows","cols"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/compare":{"get":{"tags":["stats"],"summary":"Compare two groups or two periods: t-test, Mann-Whitney and share test, in plain words","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsCompare","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"offsetMinutes","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":-720,"maximum":840}},{"name":"quality","in":"query","required":false,"schema":{"default":"all","type":"string","enum":["all","exclude_flagged","only_flagged"]}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}},{"name":"confidence","in":"query","required":false,"schema":{"default":0.95,"type":"number"}},{"name":"by","in":"query","required":false,"schema":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]}},{"name":"a","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":128}},{"name":"b","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":128}},{"name":"aFrom","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"aTo","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"bFrom","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"bTo","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/trend":{"get":{"tags":["stats"],"summary":"Daily score with control-chart alerts and a forecast with its prediction band","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsTrend","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"offsetMinutes","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":-720,"maximum":840}},{"name":"quality","in":"query","required":false,"schema":{"default":"all","type":"string","enum":["all","exclude_flagged","only_flagged"]}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}},{"name":"measure","in":"query","required":false,"schema":{"default":"score","type":"string","enum":["score","share"]}},{"name":"baseline","in":"query","required":false,"schema":{"type":"integer","minimum":7,"maximum":366}},{"name":"horizon","in":"query","required":false,"schema":{"default":14,"type":"integer","minimum":0,"maximum":90}},{"name":"confidence","in":"query","required":false,"schema":{"default":0.95,"type":"number"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/sample-size":{"get":{"tags":["stats"],"summary":"Margin of error per group and how many more answers reach the target","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsSampleSize","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"offsetMinutes","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":-720,"maximum":840}},{"name":"quality","in":"query","required":false,"schema":{"default":"all","type":"string","enum":["all","exclude_flagged","only_flagged"]}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}},{"name":"by","in":"query","required":false,"schema":{"default":"orgUnit","anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]}},{"name":"target","in":"query","required":false,"schema":{"default":5,"type":"number","minimum":0.5,"maximum":50}},{"name":"confidence","in":"query","required":false,"schema":{"default":0.95,"type":"number"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/response-quality":{"get":{"tags":["stats"],"summary":"How many completed responses were checked for speeding and straight-lining, and how many were flagged (the statistics routes take quality=all|exclude_flagged|only_flagged)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsResponseQuality","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/report-query/run":{"post":{"tags":["stats"],"summary":"Run a ReportQuery v1 through the governed semantic layer in their own scope (Report Center WP1 1.4); 403 REPORT_QUERY_OUT_OF_SCOPE for a unit outside it","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdStatsReportQueryRun","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"query":{"description":"A ReportQuery v1 (packages/report-query/src/contract.ts): version, metrics, dimensions, filters, dateRange, compare, minBase, limit"},"noCache":{"type":"boolean"},"path":{"default":"api","type":"string","enum":["builder","stats","home","api"]}},"required":["query"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/weights/profile":{"post":{"tags":["stats"],"summary":"Categories, answers and sample share of up to five dimensions, to enter population targets for rim weighting","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdStatsWeightsProfile","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"filters":{"default":{"offsetMinutes":0,"quality":"all"},"type":"object","properties":{"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"offsetMinutes":{"default":0,"type":"integer","minimum":-720,"maximum":840},"quality":{"default":"all","type":"string","enum":["all","exclude_flagged","only_flagged"]}},"additionalProperties":false},"lang":{"default":"en","type":"string","enum":["en","ar"]},"dimensions":{"minItems":1,"maxItems":5,"type":"array","items":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]}}},"required":["dimensions"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/weights":{"post":{"tags":["stats"],"summary":"Rim weights (raking) from population targets in percent: iterations, efficiency, effective base, smallest and largest weight, and the margins per category; stores nothing","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdStatsWeights","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"filters":{"default":{"offsetMinutes":0,"quality":"all"},"type":"object","properties":{"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"offsetMinutes":{"default":0,"type":"integer","minimum":-720,"maximum":840},"quality":{"default":"all","type":"string","enum":["all","exclude_flagged","only_flagged"]}},"additionalProperties":false},"lang":{"default":"en","type":"string","enum":["en","ar"]},"weighting":{"type":"object","properties":{"targets":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"dimension":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"shares":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":128},"additionalProperties":{"type":"number","minimum":0,"maximum":1000000000}}},"required":["dimension","shares"],"additionalProperties":false}},"trim":{"type":"object","properties":{"min":{"type":"number","minimum":0.01,"maximum":1},"max":{"type":"number","minimum":1,"maximum":100}},"required":["min","max"],"additionalProperties":false},"maxIterations":{"type":"integer","minimum":1,"maximum":200}},"required":["targets"],"additionalProperties":false}},"required":["weighting"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/export":{"post":{"tags":["stats"],"summary":"Labelled CSV, CSV with SPSS syntax, or a native SPSS .sav file (base64) of the scores, with optional rim weights","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdStatsExport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"filters":{"default":{"offsetMinutes":0,"quality":"all"},"type":"object","properties":{"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"offsetMinutes":{"default":0,"type":"integer","minimum":-720,"maximum":840},"quality":{"default":"all","type":"string","enum":["all","exclude_flagged","only_flagged"]}},"additionalProperties":false},"format":{"default":"csv","type":"string","enum":["csv","spss","sav"]},"lang":{"default":"en","type":"string","enum":["en","ar"]},"weighting":{"type":"object","properties":{"targets":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"dimension":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"shares":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":128},"additionalProperties":{"type":"number","minimum":0,"maximum":1000000000}}},"required":["dimension","shares"],"additionalProperties":false}},"trim":{"type":"object","properties":{"min":{"type":"number","minimum":0.01,"maximum":1},"max":{"type":"number","minimum":1,"maximum":100}},"required":["min","max"],"additionalProperties":false},"maxIterations":{"type":"integer","minimum":1,"maximum":200}},"required":["targets"],"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/sites":{"get":{"tags":["gov"],"summary":"Mystery-shopping sites: a branch with its GPS area, a phone line or a website or app with its address (a member limited to some units sees only theirs)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysterySites","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","all"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["gov"],"summary":"Add a site: a branch with GPS area, phone line or website/app (an https address); its type never changes; whole-organisation access only","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovMysterySites","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,39}$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":200},"en":{"type":"string","maxLength":200}},"additionalProperties":false},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"channel":{"default":"field","type":"string","enum":["field","call","digital"]},"address":{"type":"string","minLength":1,"maxLength":500},"lat":{"type":"number","minimum":-90,"maximum":90},"lng":{"type":"number","minimum":-180,"maximum":180},"radiusM":{"type":"integer","minimum":10,"maximum":2000}},"required":["code","name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/sites/{siteId}":{"patch":{"tags":["gov"],"summary":"Change or deactivate a site (never deleted, never another type; the address must suit its type); whole-organisation access only","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdGovMysterySitesSiteId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"siteId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,39}$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":200},"en":{"type":"string","maxLength":200}},"additionalProperties":false},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"address":{"type":"string","minLength":1,"maxLength":500},"lat":{"type":"number","minimum":-90,"maximum":90},"lng":{"type":"number","minimum":-180,"maximum":180},"radiusM":{"type":"integer","minimum":10,"maximum":2000},"active":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/checklists/starter":{"get":{"tags":["gov"],"summary":"A starter checklist to copy and change: a service-centre visit (default), a mystery call or a digital visit","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryChecklistsStarter","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"channel","in":"query","required":false,"schema":{"default":"field","type":"string","enum":["field","call","digital"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/checklists":{"get":{"tags":["gov"],"summary":"Checklist versions (unpublished, published, retired), newest version first per key","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryChecklists","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["gov"],"summary":"Save a new unpublished version of a checklist (sections of yes/no, rating, timer, choice and note items with photo rules)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovMysteryChecklists","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"checklist":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"title":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"sections":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"title":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"items":{"minItems":1,"maxItems":200,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"yes_no"},"good":{"type":"boolean"}},"required":["id","label","kind"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"rating"}},"required":["id","label","kind"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"timer"},"targetSeconds":{"type":"integer","exclusiveMinimum":0,"maximum":86400},"maxSeconds":{"type":"integer","exclusiveMinimum":0,"maximum":86400}},"required":["id","label","kind","targetSeconds"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"choice"},"options":{"minItems":2,"maxItems":10,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"points":{"type":"number","minimum":0}},"required":["id","label","points"],"additionalProperties":false}}},"required":["id","label","kind","options"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"note"}},"required":["id","label","kind"],"additionalProperties":false}]}}},"required":["id","title","items"],"additionalProperties":false}},"passPercent":{"type":"number","minimum":0,"maximum":100},"requireCheckIn":{"type":"boolean"},"channel":{"type":"string","enum":["field","call","digital"]}},"required":["key","title","sections"],"additionalProperties":false},"ticketSeverity":{"type":"string","enum":["low","medium","high"]}},"required":["checklist"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/checklists/{checklistId}":{"get":{"tags":["gov"],"summary":"One checklist version","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryChecklistsChecklistId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"checklistId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gov"],"summary":"Replace an unpublished checklist version; a published version never changes (409)","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdGovMysteryChecklistsChecklistId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"checklistId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"checklist":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"title":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"sections":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"title":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"items":{"minItems":1,"maxItems":200,"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"yes_no"},"good":{"type":"boolean"}},"required":["id","label","kind"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"rating"}},"required":["id","label","kind"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"timer"},"targetSeconds":{"type":"integer","exclusiveMinimum":0,"maximum":86400},"maxSeconds":{"type":"integer","exclusiveMinimum":0,"maximum":86400}},"required":["id","label","kind","targetSeconds"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"choice"},"options":{"minItems":2,"maxItems":10,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"points":{"type":"number","minimum":0}},"required":["id","label","points"],"additionalProperties":false}}},"required":["id","label","kind","options"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"label":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"hint":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"required":["ar","en"],"additionalProperties":false},"weight":{"type":"number","exclusiveMinimum":0,"maximum":100},"critical":{"type":"boolean"},"photo":{"type":"string","enum":["none","optional","required"]},"allowNa":{"type":"boolean"},"kind":{"type":"string","const":"note"}},"required":["id","label","kind"],"additionalProperties":false}]}}},"required":["id","title","items"],"additionalProperties":false}},"passPercent":{"type":"number","minimum":0,"maximum":100},"requireCheckIn":{"type":"boolean"},"channel":{"type":"string","enum":["field","call","digital"]}},"required":["key","title","sections"],"additionalProperties":false},"ticketSeverity":{"type":"string","enum":["low","medium","high"]}},"required":["checklist"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/checklists/{checklistId}/publish":{"post":{"tags":["gov"],"summary":"Publish an unpublished version so visits can be assigned","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovMysteryChecklistsChecklistIdPublish","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"checklistId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/checklists/{checklistId}/retire":{"post":{"tags":["gov"],"summary":"Retire a published checklist (no new visits)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovMysteryChecklistsChecklistIdRetire","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"checklistId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/scores":{"get":{"tags":["gov"],"summary":"Site scores from approved visits in a date window, of field branches unless channel is given; sites with fewer than three visits are flagged and ranked last","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryScores","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"channel","in":"query","required":false,"schema":{"default":"field","type":"string","enum":["field","call","digital"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/agents":{"get":{"tags":["gov"],"summary":"Contact-centre agent scores from approved mystery calls at phone lines in scope, by employee code (never a name); agents with fewer than three calls are flagged and ranked last; counts the calls without an agent code","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryAgents","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/findings":{"get":{"tags":["gov"],"summary":"Findings of approved visits at sites in scope, newest first with cursor paging, with the item label, the ticket state (none, pending, opened, failed), the ticket id and the last error","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryFindings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"ticketState","in":"query","required":false,"schema":{"type":"string","enum":["none","pending","opened","failed"]}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":300}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/findings/{findingId}/ticket":{"post":{"tags":["gov"],"summary":"Approve a closed-loop ticket for one finding (one below the ticket severity, or a failed or unfinished one sent again); one ticket per finding however often it is sent; whole-organisation access only; 30 a minute per person (429 RATE_LIMITED); audited","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovMysteryFindingsFindingIdTicket","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"findingId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits":{"post":{"tags":["gov"],"summary":"Assign a visit of a published checklist at an active site of the same type (400 GOV_CHANNEL_MISMATCH) to a staff shopper, optionally in a programme whose dates cover it (400 GOV_PROGRAMME_DATES); whole-organisation access only","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovMysteryVisits","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"checklistId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"siteId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"shopperId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"dueFrom":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueTo":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"programmeId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["checklistId","siteId","shopperId","dueFrom","dueTo"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["gov"],"summary":"Visits, newest first with cursor paging (a member without whole-organisation access sees the visits assigned to them and those at sites of their units)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryVisits","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["assigned","in_progress","submitted","approved","rejected","cancelled"]}},{"name":"siteId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"shopperId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"channel","in":"query","required":false,"schema":{"type":"string","enum":["field","call","digital"]}},{"name":"programmeId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":300}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits/{visitId}":{"get":{"tags":["gov"],"summary":"One visit with its checklist, site and what still stops it from being submitted","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryVisitsVisitId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits/{visitId}/start":{"post":{"tags":["gov"],"summary":"The assigned shopper starts the visit: a branch visit with a GPS check-in (only the distance and the result are kept), a call or digital visit without one","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdGovMysteryVisitsVisitIdStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"fix":{"type":"object","properties":{"lat":{"type":"number","minimum":-90,"maximum":90},"lng":{"type":"number","minimum":-180,"maximum":180},"accuracyM":{"type":"number","minimum":0,"maximum":100000},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["lat","lng","accuracyM","at"],"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits/{visitId}/answers/{itemId}":{"put":{"tags":["gov"],"summary":"The assigned shopper answers one item, with photo refs from the files seam and a note","description":"Permission: `tickets.write`.","operationId":"putV1TenantsTenantIdGovMysteryVisitsVisitIdAnswersItemId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"itemId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"value":{"anyOf":[{"anyOf":[{"type":"boolean"},{"type":"number"},{"type":"string","maxLength":1000}]},{"type":"null"}]},"na":{"type":"boolean"},"photos":{"maxItems":5,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"key":{"type":"string","minLength":1,"maxLength":512,"pattern":"^[A-Za-z0-9][A-Za-z0-9._\\-/]*$"},"contentType":{"type":"string","pattern":"^image\\/(jpeg|png|webp|heic|heif)$"},"size":{"type":"integer","exclusiveMinimum":0,"maximum":10485760}},"required":["id","key","contentType","size"],"additionalProperties":false}},"note":{"type":"string","maxLength":1000}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits/{visitId}/evidence":{"put":{"tags":["gov"],"summary":"The assigned shopper sets the whole evidence of a call (reference, https recording link, ISO call time, length, agent code) or digital visit (https page address, device, screenshot refs); needed before submit; 400 on a branch visit","description":"Permission: `tickets.write`.","operationId":"putV1TenantsTenantIdGovMysteryVisitsVisitIdEvidence","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"callRef":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,64}$"},"recordingUrl":{"type":"string","maxLength":2000,"format":"uri"},"calledAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"durationSeconds":{"type":"integer","minimum":1,"maximum":14400},"agentCode":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,39}$"},"url":{"type":"string","maxLength":2000,"format":"uri"},"device":{"type":"string","enum":["desktop","mobile_web","app"]},"screenshots":{"maxItems":5,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"key":{"type":"string","minLength":1,"maxLength":512,"pattern":"^[A-Za-z0-9][A-Za-z0-9._\\-/]*$"},"contentType":{"type":"string","pattern":"^image\\/(jpeg|png|webp|heic|heif)$"},"size":{"type":"integer","exclusiveMinimum":0,"maximum":10485760}},"required":["id","key","contentType","size"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits/{visitId}/timers/{itemId}/start":{"post":{"tags":["gov"],"summary":"Start (or restart) the timer of a timer item","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdGovMysteryVisitsVisitIdTimersItemIdStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"itemId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits/{visitId}/timers/{itemId}/stop":{"post":{"tags":["gov"],"summary":"Stop a running timer; the seconds become the answer","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdGovMysteryVisitsVisitIdTimersItemIdStop","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"itemId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits/{visitId}/submit":{"post":{"tags":["gov"],"summary":"Submit the visit and fix its score; an incomplete visit is refused with the open items (409)","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdGovMysteryVisitsVisitIdSubmit","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits/{visitId}/review":{"post":{"tags":["gov"],"summary":"Approve (findings are recorded and those at or above the checklist ticket severity open closed-loop tickets), reject or return a submitted visit; answers how many tickets opened and failed; whole-organisation access only, never by the visit shopper (403 GOV_SELF_REVIEW); audited","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovMysteryVisitsVisitIdReview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"decision":{"type":"string","enum":["approve","reject","return"]},"note":{"type":"string","maxLength":1000}},"required":["decision"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/visits/{visitId}/cancel":{"post":{"tags":["gov"],"summary":"Cancel an assigned or started visit (never deleted); whole-organisation access only","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovMysteryVisitsVisitIdCancel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"visitId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/programmes":{"get":{"tags":["gov"],"summary":"Mystery-shopping programmes with their targets per visit type (field, call, digital) and progress on today's Riyadh day: approved (delivered), awaiting review, in progress, scheduled, rejected and cancelled visits, the count expected by today and whether each type is on track; a member limited to some units gets only the counts of visits at sites of those units (progress.scope \"units\"; the targets stay organisation-wide)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryProgrammes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["gov"],"summary":"Add a programme: a key, a name, first and last day and the visits to deliver per visit type; whole-organisation access only; audited","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovMysteryProgrammes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":200},"en":{"type":"string","maxLength":200}},"additionalProperties":false},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"targets":{"type":"object","properties":{"field":{"type":"integer","minimum":0,"maximum":100000},"call":{"type":"integer","minimum":0,"maximum":100000},"digital":{"type":"integer","minimum":0,"maximum":100000}},"required":["field","call","digital"],"additionalProperties":false}},"required":["key","name","startsOn","endsOn","targets"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/mystery/programmes/{programmeId}":{"get":{"tags":["gov"],"summary":"One programme with its progress (counts limited to the caller's units as in the list, progress.scope)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovMysteryProgrammesProgrammeId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"programmeId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["gov"],"summary":"Change a programme's name, last day, targets or active flag (the key and first day stay; never deleted); a last day before a visit still due is refused (409 GOV_PROGRAMME_DATES); whole-organisation access only; audited","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdGovMysteryProgrammesProgrammeId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"programmeId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":200},"en":{"type":"string","maxLength":200}},"additionalProperties":false},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"targets":{"type":"object","properties":{"field":{"type":"integer","minimum":0,"maximum":100000},"call":{"type":"integer","minimum":0,"maximum":100000},"digital":{"type":"integer","minimum":0,"maximum":100000}},"additionalProperties":false},"active":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/sessions":{"get":{"tags":["gov"],"summary":"Focus-group sessions, newest first; whole-organisation access only","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovCocreationSessions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","all"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["gov"],"summary":"Record a focus-group session (pseudonymous participants with consent, notes, recordings, transcript); whole-organisation access only","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovCocreationSessions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"object","properties":{"en":{"type":"string","maxLength":200},"ar":{"type":"string","maxLength":200}},"required":["en","ar"],"additionalProperties":false},"topic":{"type":"object","properties":{"en":{"type":"string","maxLength":500},"ar":{"type":"string","maxLength":500}},"required":["en","ar"],"additionalProperties":false},"mode":{"type":"string","enum":["in_person","online","hybrid"]},"startsAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"endsAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"moderatorRef":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,19}$"},"participants":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"ref":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,19}$"},"segment":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"consent":{"type":"object","properties":{"recording":{"type":"boolean"},"quotes":{"type":"boolean"}},"required":["recording","quotes"],"additionalProperties":false}},"required":["ref","consent"],"additionalProperties":false}},"notes":{"default":[],"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"},"atSec":{"type":"number","minimum":0,"maximum":86400},"by":{"type":"string","enum":["moderator","observer"]},"participantRef":{"anyOf":[{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,19}$"},{"type":"null"}]},"text":{"type":"string","maxLength":4000},"lang":{"type":"string","enum":["ar","en"]},"redacted":{"type":"boolean"}},"required":["id","atSec","by","text"],"additionalProperties":false}},"recordings":{"default":[],"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"},"kind":{"type":"string","enum":["audio","video"]},"storageKey":{"type":"string","minLength":1,"maxLength":512,"pattern":"^[A-Za-z0-9][A-Za-z0-9._\\-/]*$"},"durationSec":{"type":"number","exclusiveMinimum":0,"maximum":86400},"segments":{"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"},"startSec":{"type":"number","minimum":0},"endSec":{"type":"number","minimum":0},"speakerRef":{"anyOf":[{"type":"string","pattern":"^([A-Za-z][A-Za-z0-9_-]{0,19}|moderator)$"},{"type":"null"}]},"text":{"type":"string","maxLength":4000},"lang":{"type":"string","enum":["ar","en"]},"redacted":{"type":"boolean"}},"required":["id","startSec","endSec","text"],"additionalProperties":false}}},"required":["id","kind","storageKey","durationSec"],"additionalProperties":false}}},"required":["title","topic","mode","startsAt","moderatorRef","participants"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/sessions/{sessionId}":{"get":{"tags":["gov"],"summary":"One session with its notes and transcript in time order; whole-organisation access only","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovCocreationSessionsSessionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gov"],"summary":"Replace a session record read at updatedAt (409 when it changed since); a withdrawn participant stays withdrawn and blanked","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdGovCocreationSessionsSessionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"session":{"type":"object","properties":{"title":{"type":"object","properties":{"en":{"type":"string","maxLength":200},"ar":{"type":"string","maxLength":200}},"required":["en","ar"],"additionalProperties":false},"topic":{"type":"object","properties":{"en":{"type":"string","maxLength":500},"ar":{"type":"string","maxLength":500}},"required":["en","ar"],"additionalProperties":false},"mode":{"type":"string","enum":["in_person","online","hybrid"]},"startsAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"endsAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"moderatorRef":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,19}$"},"participants":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"ref":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,19}$"},"segment":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"consent":{"type":"object","properties":{"recording":{"type":"boolean"},"quotes":{"type":"boolean"}},"required":["recording","quotes"],"additionalProperties":false}},"required":["ref","consent"],"additionalProperties":false}},"notes":{"default":[],"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"},"atSec":{"type":"number","minimum":0,"maximum":86400},"by":{"type":"string","enum":["moderator","observer"]},"participantRef":{"anyOf":[{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,19}$"},{"type":"null"}]},"text":{"type":"string","maxLength":4000},"lang":{"type":"string","enum":["ar","en"]},"redacted":{"type":"boolean"}},"required":["id","atSec","by","text"],"additionalProperties":false}},"recordings":{"default":[],"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"},"kind":{"type":"string","enum":["audio","video"]},"storageKey":{"type":"string","minLength":1,"maxLength":512,"pattern":"^[A-Za-z0-9][A-Za-z0-9._\\-/]*$"},"durationSec":{"type":"number","exclusiveMinimum":0,"maximum":86400},"segments":{"maxItems":2000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"},"startSec":{"type":"number","minimum":0},"endSec":{"type":"number","minimum":0},"speakerRef":{"anyOf":[{"type":"string","pattern":"^([A-Za-z][A-Za-z0-9_-]{0,19}|moderator)$"},{"type":"null"}]},"text":{"type":"string","maxLength":4000},"lang":{"type":"string","enum":["ar","en"]},"redacted":{"type":"boolean"}},"required":["id","startSec","endSec","text"],"additionalProperties":false}}},"required":["id","kind","storageKey","durationSec"],"additionalProperties":false}}},"required":["title","topic","mode","startsAt","moderatorRef","participants"],"additionalProperties":false},"updatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["session","updatedAt"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["gov"],"summary":"Archive or restore a session (never deleted)","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdGovCocreationSessionsSessionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"archived":{"type":"boolean"}},"required":["archived"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/sessions/{sessionId}/participants/{ref}/consent":{"patch":{"tags":["gov"],"summary":"Change what an active participant agreed to (recording consent cannot be taken back while recordings exist: 409)","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdGovCocreationSessionsSessionIdParticipantsRefConsent","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ref","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"recording":{"type":"boolean"},"quotes":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/sessions/{sessionId}/participants/{ref}/withdraw":{"post":{"tags":["gov"],"summary":"A participant withdraws: consent is taken back and their words and the notes about them are blanked","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovCocreationSessionsSessionIdParticipantsRefWithdraw","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sessionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ref","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/theme-sets":{"post":{"tags":["gov"],"summary":"Suggest themes across sessions from masked text (keyword groups, no model call) for a person to review","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovCocreationThemeSets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"sessionIds":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"names":{"maxItems":200,"type":"array","items":{"type":"string","minLength":2,"maxLength":100}},"minSize":{"type":"integer","minimum":2,"maximum":50}},"required":["sessionIds"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["gov"],"summary":"Stored theme sets, newest first; whole-organisation access only","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovCocreationThemeSets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/theme-sets/{setId}":{"get":{"tags":["gov"],"summary":"One theme set with quotes from consenting participants only","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovCocreationThemeSetsSetId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"setId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/theme-sets/{setId}/review":{"post":{"tags":["gov"],"summary":"Approve (with a bilingual label), reject or merge suggested themes","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovCocreationThemeSetsSetIdReview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"setId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"decisions":{"minItems":1,"maxItems":100,"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":100},"action":{"type":"string","const":"approve"},"label":{"type":"object","properties":{"en":{"type":"string","maxLength":120},"ar":{"type":"string","maxLength":120}},"required":["en","ar"],"additionalProperties":false}},"required":["key","action"],"additionalProperties":false},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":100},"action":{"type":"string","const":"reject"}},"required":["key","action"],"additionalProperties":false},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":100},"action":{"type":"string","const":"merge"},"into":{"type":"string","minLength":1,"maxLength":100}},"required":["key","action","into"],"additionalProperties":false}]}}},"required":["decisions"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/rounds":{"get":{"tags":["gov"],"summary":"Participatory-budget rounds with their state (not open, open, closed); whole-organisation access only","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovCocreationRounds","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["gov"],"summary":"Set up a participatory-budget round (approval, budget or points ballots; amounts in halalas)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovCocreationRounds","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"object","properties":{"en":{"type":"string","maxLength":200},"ar":{"type":"string","maxLength":200}},"required":["en","ar"],"additionalProperties":false},"totalHalalas":{"type":"integer","exclusiveMinimum":0,"maximum":100000000000000},"method":{"type":"string","enum":["approval","budget","points"]},"projects":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"},"title":{"type":"object","properties":{"en":{"type":"string","maxLength":200},"ar":{"type":"string","maxLength":200}},"required":["en","ar"],"additionalProperties":false},"costHalalas":{"type":"integer","exclusiveMinimum":0,"maximum":10000000000000},"area":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["id","title","costHalalas"],"additionalProperties":false}},"maxApprovals":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"points":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":1000},{"type":"null"}]},"opensAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"closesAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"eligible":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]}},"required":["title","totalHalalas","method","projects","opensAt","closesAt"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/rounds/{roundId}":{"get":{"tags":["gov"],"summary":"One round; whole-organisation access only","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovCocreationRoundsRoundId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"roundId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gov"],"summary":"Replace a round before voting opens (afterwards 409)","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdGovCocreationRoundsRoundId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"roundId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"object","properties":{"en":{"type":"string","maxLength":200},"ar":{"type":"string","maxLength":200}},"required":["en","ar"],"additionalProperties":false},"totalHalalas":{"type":"integer","exclusiveMinimum":0,"maximum":100000000000000},"method":{"type":"string","enum":["approval","budget","points"]},"projects":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"},"title":{"type":"object","properties":{"en":{"type":"string","maxLength":200},"ar":{"type":"string","maxLength":200}},"required":["en","ar"],"additionalProperties":false},"costHalalas":{"type":"integer","exclusiveMinimum":0,"maximum":10000000000000},"area":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]}},"required":["id","title","costHalalas"],"additionalProperties":false}},"maxApprovals":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"points":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":1000},{"type":"null"}]},"opensAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"closesAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"eligible":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]}},"required":["title","totalHalalas","method","projects","opensAt","closesAt"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/rounds/{roundId}/ballots":{"post":{"tags":["gov"],"summary":"Record one ballot while the round is open (else 409); the voter key, a random token, is stored only as an HMAC under the server pepper (a pseudonym; 503 GOV_VOTER_PEPPER_NOT_CONFIGURED without one); the last ballot recorded per voter counts; invalid ballots are refused with their issues","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovCocreationRoundsRoundIdBallots","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"roundId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"voterKey":{"type":"string","minLength":16,"maxLength":200},"castAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"projectIds":{"maxItems":200,"type":"array","items":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"}},"points":{"type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$"},"additionalProperties":{"type":"integer","minimum":0,"maximum":1000}}},"required":["voterKey"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cocreation/rounds/{roundId}/results":{"get":{"tags":["gov"],"summary":"Votes per project, ranking, funded projects (greedy by votes within the budget) and turnout; whole-organisation access only","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovCocreationRoundsRoundIdResults","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"roundId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/voc":{"get":{"tags":["gov"],"summary":"Voice of the Customer: field, contact-centre, digital and mystery-shopping results with one indicator set, by family, channel, site and period, with the previous period","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdGovVoc","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"grain","in":"query","required":false,"schema":{"default":"month","type":"string","enum":["month","week"]}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"x-sayvara-contract":{"response":"govVocView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/template":{"get":{"tags":["gov"],"summary":"The beneficiary survey pack (levels 1-3, six aspects), the bands, the method version and what using the pack creates (a gov_service survey on WhatsApp, web and QR)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovTemplate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/services":{"get":{"tags":["gov"],"summary":"Services with their names and the surveys that measure them","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovServices","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","all"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/services/{serviceId}":{"patch":{"tags":["gov"],"summary":"Name a service, map it to its surveys and unit, or turn it off","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdGovServicesServiceId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"serviceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":200},"en":{"type":"string","maxLength":200}},"additionalProperties":false},"surveyIds":{"maxItems":20,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"active":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/volumes/import":{"post":{"tags":["gov"],"summary":"Import monthly transaction volumes (CSV text); bad lines are listed and skipped (201; a dryRun check stores nothing and answers 200)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovVolumesImport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"csv":{"type":"string","minLength":1,"maxLength":95000},"fileName":{"type":"string","minLength":1,"maxLength":200},"dryRun":{"default":false,"type":"boolean"}},"required":["csv"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/volumes/months":{"get":{"tags":["gov"],"summary":"Months that have transaction volumes, newest first","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovVolumesMonths","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/volumes/imports":{"get":{"tags":["gov"],"summary":"Past volume imports, newest first: file, who imported it, rows read and rejected, months and transactions still in use","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovVolumesImports","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/volumes/imports/{importId}":{"get":{"tags":["gov"],"summary":"The per-service monthly transactions that still come from one volume import","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovVolumesImportsImportId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"importId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/coverage":{"get":{"tags":["gov"],"summary":"The services that make up the coverage target (80 %) of transactions in a window","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovCoverage","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/settings":{"get":{"tags":["gov"],"summary":"Minimum sample per service, minimum base, low-sample opt-in and coverage target","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gov"],"summary":"Change the minimum sample (30 or more), the minimum base (30 up to 1000 and never above the minimum sample; GOV_INVALID otherwise), the low-sample opt-in or the coverage target","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdGovSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"minSample":{"type":"integer","minimum":30,"maximum":100000},"minBase":{"type":"integer","minimum":30,"maximum":1000},"includeLowSample":{"type":"boolean"},"coverageTarget":{"type":"number","minimum":0.5,"maximum":1},"vocRateTarget":{"anyOf":[{"type":"number","minimum":0,"maximum":100,"multipleOf":0.1},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/index-runs":{"post":{"tags":["gov"],"summary":"Compute and store the transaction-weighted index for a window (whole-organisation access only)","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdGovIndexRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"from":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"},"to":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}},"required":["from","to"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["gov"],"summary":"Stored index runs, newest first","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovIndexRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/index-runs/{runId}":{"get":{"tags":["gov"],"summary":"One index run: services, margins, sample warnings, aspects and inputs","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovIndexRunsRunId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/actions":{"get":{"tags":["gov"],"summary":"Improvement actions of a quarter","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovActions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["gov"],"summary":"Record an improvement action for a quarter","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovActions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"quarter":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"},"aspect":{"anyOf":[{"type":"string","enum":["procedures","environment","speed","staff","digital","outcome"]},{"type":"null"}]},"serviceId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"title":{"type":"object","properties":{"ar":{"type":"string","maxLength":200},"en":{"type":"string","maxLength":200}},"additionalProperties":false},"detail":{"anyOf":[{"type":"object","properties":{"ar":{"type":"string","maxLength":1000},"en":{"type":"string","maxLength":1000}},"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["planned","in_progress","done","dropped"]}},"required":["quarter","title"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/actions/{actionId}":{"patch":{"tags":["gov"],"summary":"Change an action or its status (dropped instead of deleted)","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdGovActionsActionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"actionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"aspect":{"anyOf":[{"type":"string","enum":["procedures","environment","speed","staff","digital","outcome"]},{"type":"null"}]},"serviceId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"title":{"type":"object","properties":{"ar":{"type":"string","maxLength":200},"en":{"type":"string","maxLength":200}},"additionalProperties":false},"detail":{"anyOf":[{"type":"object","properties":{"ar":{"type":"string","maxLength":1000},"en":{"type":"string","maxLength":1000}},"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["planned","in_progress","done","dropped"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/reports/quarterly":{"get":{"tags":["gov"],"summary":"The quarterly beneficiary report: data (json) or the print page (html: Arabic then English, or one language with lang); whole-organisation access only","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdGovReportsQuarterly","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"}},{"name":"format","in":"query","required":false,"schema":{"default":"json","type":"string","enum":["json","html"]}},{"name":"lang","in":"query","required":false,"schema":{"type":"string","enum":["ar","en"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/reports/quarterly/pdf":{"post":{"tags":["gov"],"summary":"Ask for a stored PDF of the quarterly print page in one language (lang, default ar): 202 with the export to poll; whole-organisation access only","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdGovReportsQuarterlyPdf","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"quarter":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"},"lang":{"default":"ar","type":"string","enum":["ar","en"]}},"required":["quarter"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/reports/exports/{exportId}":{"get":{"tags":["gov"],"summary":"A requested report PDF: queued, ready with a signed download link (7 days at most), or failed","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdGovReportsExportsExportId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"exportId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/reports/quarterly/full":{"get":{"tags":["gov"],"summary":"The full quarterly beneficiary voice report: data (json, both languages, with the editable narrative), the print page (html) or the slide deck (pptx) of one language; beneficiary quotes only with quotes=true; whole-organisation access only","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdGovReportsQuarterlyFull","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"quarter","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"}},{"name":"lang","in":"query","required":false,"schema":{"default":"ar","type":"string","enum":["ar","en"]}},{"name":"format","in":"query","required":false,"schema":{"default":"json","type":"string","enum":["json","html","pptx"]}},{"name":"quotes","in":"query","required":false,"schema":{"default":"false","type":"string","enum":["true","false"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/reports/quarterly/full/pdf":{"post":{"tags":["gov"],"summary":"Ask for a stored PDF of one language of the full report: 202 with the export to poll; quotes only when asked; whole-organisation access only","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdGovReportsQuarterlyFullPdf","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"quarter":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"},"lang":{"default":"ar","type":"string","enum":["ar","en"]},"quotes":{"default":false,"type":"boolean"}},"required":["quarter"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/reports/quarterly/full/narrative":{"put":{"tags":["gov"],"summary":"Save the edited narrative of the full report: each text sent replaces that section and language, the others are kept; an empty text uses the template again","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdGovReportsQuarterlyFullNarrative","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"quarter":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"},"sections":{"type":"object","propertyNames":{"type":"string","enum":["summary","index","aspects","services","themes","complaints","actions","method"]},"additionalProperties":{"type":"object","properties":{"ar":{"type":"string","maxLength":2000},"en":{"type":"string","maxLength":2000}},"additionalProperties":false}}},"required":["quarter","sections"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/reports/quarterly/full/narrative/draft":{"post":{"tags":["gov"],"summary":"Write a suggested narrative of one language from the computed figures through the AI gateway, with the templated text as fallback; nothing is stored","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdGovReportsQuarterlyFullNarrativeDraft","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"quarter":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"},"lang":{"type":"string","enum":["ar","en"]},"sections":{"minItems":1,"maxItems":8,"type":"array","items":{"type":"string","enum":["summary","index","aspects","services","themes","complaints","actions","method"]}}},"required":["quarter","lang"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/reports/autorun":{"get":{"tags":["gov"],"summary":"The quarterly auto-run: whether this server can run it (available), whether it is on, and the recent quarters (status, recipients sent to, signed links to the report PDF and full report deck per language, one hour); whole-organisation access only","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdGovReportsAutorun","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gov"],"summary":"Turn the quarterly auto-run on or off: after each quarter closes, the index run, the report PDF and the full report deck in Arabic and English go to the owners and admins by email; audited; turning it on answers 409 GOV_AUTORUN_UNAVAILABLE while it is not available","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdGovReportsAutorun","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/dga/kpis":{"get":{"tags":["gov"],"summary":"Complaints-handling KPIs mapped to the four published digital experience pillars, with the tickets behind each figure: data, CSV (KPIs or the ticket list) or the bilingual print page; whole-organisation access only","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdGovDgaKpis","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}},{"name":"format","in":"query","required":false,"schema":{"default":"json","type":"string","enum":["json","csv","html"]}},{"name":"part","in":"query","required":false,"schema":{"default":"kpis","type":"string","enum":["kpis","tickets"]}},{"name":"lang","in":"query","required":false,"schema":{"type":"string","enum":["ar","en"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/qiyas/evidence":{"get":{"tags":["gov"],"summary":"Evidence pack for the beneficiary axes of the published digital transformation measurement criteria (axis numbers to be checked against the current criteria): data, CSV or the bilingual print page; whole-organisation access only","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdGovQiyasEvidence","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}},{"name":"format","in":"query","required":false,"schema":{"default":"json","type":"string","enum":["json","csv","html"]}},{"name":"lang","in":"query","required":false,"schema":{"type":"string","enum":["ar","en"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/sama/preset/preview":{"post":{"tags":["gov"],"summary":"Preview the banking complaint-management preset (designed around the complaint-handling method the banking regulator publishes; not certified or approved by any regulator): Level 1 and 2 queues, working-day deadlines to confirm, the SLA calendars, targets and ladders to apply, and the Ramadan warning in English and Arabic; nothing is stored","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovSamaPresetPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"level1UnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"level2UnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"dayStart":{"type":"integer","minimum":0,"maximum":1440},"dayEnd":{"type":"integer","minimum":0,"maximum":1440},"ramadan":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1440},"end":{"type":"integer","minimum":0,"maximum":1440}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"days":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"kind":{"type":"string","enum":["holiday","ramadan","workday"]},"name":{"default":"","type":"string","maxLength":80}},"required":["date","kind"],"additionalProperties":false}},"deadlines":{"type":"object","properties":{"level1Acknowledge":{"type":"integer","minimum":1,"maximum":120},"level1Resolve":{"type":"integer","minimum":1,"maximum":120},"level2Acknowledge":{"type":"integer","minimum":1,"maximum":120},"level2Resolve":{"type":"integer","minimum":1,"maximum":120}},"additionalProperties":false}},"required":["level1UnitId","level2UnitId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/sama/preset":{"get":{"tags":["gov"],"summary":"The banking complaint-management preset applied to the organisation (or null), whether the automatic move of overdue Level 1 complaints to Level 2 runs on this server, and how many moves it recorded (counts only); whole-organisation access only","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovSamaPreset","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["gov"],"summary":"Remove the applied banking complaint-management preset: the automatic move to Level 2 stops; the SLA settings stay as they are; audited; 404 when none is applied","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdGovSamaPreset","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/sama/preset/apply":{"post":{"tags":["gov"],"summary":"Apply the banking complaint-management preset: stores the preview options once the confirmed deadlines equal the preview (else 400 GOV_DEADLINES_NOT_CONFIRMED) and answers the SLA calendars, targets and ladders the screen then sends to the SLA routes; audited; whole-organisation access only","description":"Permission: `policy.manage`.","operationId":"postV1TenantsTenantIdGovSamaPresetApply","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"preset":{"type":"object","properties":{"level1UnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"level2UnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"dayStart":{"type":"integer","minimum":0,"maximum":1440},"dayEnd":{"type":"integer","minimum":0,"maximum":1440},"ramadan":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1440},"end":{"type":"integer","minimum":0,"maximum":1440}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"days":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"kind":{"type":"string","enum":["holiday","ramadan","workday"]},"name":{"default":"","type":"string","maxLength":80}},"required":["date","kind"],"additionalProperties":false}},"deadlines":{"type":"object","properties":{"level1Acknowledge":{"type":"integer","minimum":1,"maximum":120},"level1Resolve":{"type":"integer","minimum":1,"maximum":120},"level2Acknowledge":{"type":"integer","minimum":1,"maximum":120},"level2Resolve":{"type":"integer","minimum":1,"maximum":120}},"additionalProperties":false}},"required":["level1UnitId","level2UnitId"],"additionalProperties":false},"confirmedDeadlines":{"type":"object","properties":{"level1Acknowledge":{"type":"integer","minimum":1,"maximum":120},"level1Resolve":{"type":"integer","minimum":1,"maximum":120},"level2Acknowledge":{"type":"integer","minimum":1,"maximum":120},"level2Resolve":{"type":"integer","minimum":1,"maximum":120}},"required":["level1Acknowledge","level1Resolve","level2Acknowledge","level2Resolve"],"additionalProperties":false}},"required":["preset","confirmedDeadlines"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/sama/board":{"post":{"tags":["gov"],"summary":"The quarterly banking complaint board of the two queues (Level 1, Level 2, both): every KPI with a breach forecast to the quarter end, read from the tickets in scope; whole-organisation access only; nothing is stored","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdGovSamaBoard","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"quarter":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"},"preset":{"type":"object","properties":{"level1UnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"level2UnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"dayStart":{"type":"integer","minimum":0,"maximum":1440},"dayEnd":{"type":"integer","minimum":0,"maximum":1440},"ramadan":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1440},"end":{"type":"integer","minimum":0,"maximum":1440}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"days":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"kind":{"type":"string","enum":["holiday","ramadan","workday"]},"name":{"default":"","type":"string","maxLength":80}},"required":["date","kind"],"additionalProperties":false}},"deadlines":{"type":"object","properties":{"level1Acknowledge":{"type":"integer","minimum":1,"maximum":120},"level1Resolve":{"type":"integer","minimum":1,"maximum":120},"level2Acknowledge":{"type":"integer","minimum":1,"maximum":120},"level2Resolve":{"type":"integer","minimum":1,"maximum":120}},"additionalProperties":false}},"required":["level1UnitId","level2UnitId"],"additionalProperties":false},"onTimeTargetPercent":{"type":"number","minimum":50,"maximum":100}},"required":["quarter","preset"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/tender/library":{"get":{"tags":["gov"],"summary":"The bilingual tender answer library with the status of each answer (built and tested; built, switched on per customer; or not offered)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovTenderLibrary","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/tender/matrix":{"post":{"tags":["gov"],"summary":"The compliance matrix of pasted tender requirement rows (English or Arabic, NFKC-normalised, at most 300 rows of 2000 characters; pasted list markers removed, a leading number becomes the row id, other rows get #n): rows matched by words are suggestions until the bid writer confirms their answer ids; read-only, nothing is stored","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdGovTenderMatrix","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"rows":{"minItems":1,"maxItems":300,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"text":{"type":"string","minLength":1,"maxLength":2000},"mandatory":{"type":"boolean"},"answerIds":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"required":["text"],"additionalProperties":false}},"pasted":{"type":"string","maxLength":600600}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/tender/pack":{"post":{"tags":["gov"],"summary":"The tender response pack as a file in one language (en or ar, Arabic right to left): Markdown (md), a self-contained print-friendly HTML page (html) or a Word document (docx), with the bidder block, the status statement, the compliance matrix of the same rows as tender/matrix, the answers its rows name plus any chosen whole topics, and the architecture summary; attachment with an ASCII file name; audited (gov.tender.export); nothing else is stored","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdGovTenderPack","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"rows":{"minItems":1,"maxItems":300,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"text":{"type":"string","minLength":1,"maxLength":2000},"mandatory":{"type":"boolean"},"answerIds":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"required":["text"],"additionalProperties":false}},"pasted":{"type":"string","maxLength":600600},"tenderRef":{"type":"string","maxLength":80},"title":{"type":"string","maxLength":300},"buyer":{"type":"string","maxLength":300},"topics":{"minItems":1,"maxItems":13,"type":"array","items":{"type":"string","enum":["language","surveys","closed_loop","analytics","government","security","identity","privacy","hosting","integration","billing","certification","operations"]}},"lang":{"type":"string","enum":["en","ar"]},"format":{"type":"string","enum":["md","html","docx"]}},"required":["tenderRef","lang","format"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cases":{"get":{"tags":["gov"],"summary":"The organisation's live citizen case reference rows, newest first (never a reference): ticket, status, dates and decision, for the staff ticket list; ticketIds (comma-separated uuids, at most 100) keeps it to those tickets; whole-organisation access only (403 GOV_SCOPE_LIMITED)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovCases","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"default":500,"type":"integer","minimum":1,"maximum":500}},{"name":"ticketIds","in":"query","required":false,"schema":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?:,[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}){0,99}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cases/tickets/{ticketId}":{"get":{"tags":["gov"],"summary":"A ticket's live citizen case reference row (never the reference itself): status, dates and decision; tickets outside the caller's scope read as not found","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovCasesTicketsTicketId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cases/tickets/{ticketId}/reference":{"post":{"tags":["gov"],"summary":"Issue a citizen case reference for a ticket in scope, or rotate it (the old one stops working); the reference is shown only in this answer. The contact is taken on the server from the ticket's response (a contactId sent must match it); a rotation keeps the stored contact","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdGovCasesTicketsTicketIdReference","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"contactId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["createdAt"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["gov"],"summary":"Withdraw a ticket's citizen case reference: the public page then answers not found","description":"Permission: `tickets.write`.","operationId":"deleteV1TenantsTenantIdGovCasesTicketsTicketIdReference","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cases/tickets/{ticketId}/decision":{"put":{"tags":["gov"],"summary":"Write the final decision shown to the citizen (plain text, English and/or Arabic). A language not sent keeps its stored text; one sent empty is removed. publish absent keeps the published state; true publishes (resolved or closed tickets only); false unpublishes it","description":"Permission: `tickets.write`.","operationId":"putV1TenantsTenantIdGovCasesTicketsTicketIdDecision","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"en":{"type":"string","maxLength":4200},"ar":{"type":"string","maxLength":4200},"publish":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/gov/cases/{tenantSlug}/{reference}":{"get":{"tags":["gov"],"summary":"Citizen case-status lookup by reference (no sign-in, no cookies, Cache-Control: no-store): the status in English and Arabic, Riyadh dates and the published decision, never a name, unit or ticket. A wrong reference, a bad format, a withdrawn case and an unknown or inactive organisation all answer { found: false }; 429 with Retry-After per client, per client misses and per reference","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1PublicGovCasesTenantSlugReference","security":[],"parameters":[{"name":"tenantSlug","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"reference","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"govCaseLookup"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets":{"get":{"tags":["gov"],"summary":"The sector presets (GV-10 telecom, GV-11 patient experience, GV-12 e-commerce check-in) with what works now and what waits for another seam, in English and Arabic","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovPresets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/cst/preview":{"post":{"tags":["gov"],"summary":"Preview the telecom complaints preset (designed around the steps the sector regulator publishes, not approved by any regulator): the 5-working-day clock and other numbers to confirm, the SLA calendar, targets and ladder to apply, and the customer messages (reference number, solved check, reopen) in English and Arabic; nothing is stored","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovPresetsCstPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"dayStart":{"type":"integer","minimum":0,"maximum":1440},"dayEnd":{"type":"integer","minimum":0,"maximum":1440},"ramadan":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1440},"end":{"type":"integer","minimum":0,"maximum":1440}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"days":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"kind":{"type":"string","enum":["holiday","ramadan","workday"]},"name":{"default":"","type":"string","maxLength":80}},"required":["date","kind"],"additionalProperties":false}},"settings":{"type":"object","properties":{"resolveDays":{"type":"integer","minimum":1,"maximum":60},"acknowledgeDays":{"type":"integer","minimum":1,"maximum":30},"filingWindowDays":{"type":"integer","minimum":1,"maximum":365},"reopenWindowDays":{"type":"integer","minimum":1,"maximum":90},"maxReopens":{"type":"integer","minimum":0,"maximum":10}},"additionalProperties":false}},"required":["unitId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/cst/check":{"post":{"tags":["gov"],"summary":"Check one telecom complaint: its clock in working days, the filing-window check (default 60 days, a flag for staff, never a refusal) and, with the customer's reply, the decision (reopen, close, ask again) and the message to send; nothing is stored or changed","description":"Permission: `feedback.read`.","operationId":"postV1TenantsTenantIdGovPresetsCstCheck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"preset":{"type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"dayStart":{"type":"integer","minimum":0,"maximum":1440},"dayEnd":{"type":"integer","minimum":0,"maximum":1440},"ramadan":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1440},"end":{"type":"integer","minimum":0,"maximum":1440}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"days":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"kind":{"type":"string","enum":["holiday","ramadan","workday"]},"name":{"default":"","type":"string","maxLength":80}},"required":["date","kind"],"additionalProperties":false}},"settings":{"type":"object","properties":{"resolveDays":{"type":"integer","minimum":1,"maximum":60},"acknowledgeDays":{"type":"integer","minimum":1,"maximum":30},"filingWindowDays":{"type":"integer","minimum":1,"maximum":365},"reopenWindowDays":{"type":"integer","minimum":1,"maximum":90},"maxReopens":{"type":"integer","minimum":0,"maximum":10}},"additionalProperties":false}},"required":["unitId"],"additionalProperties":false},"complaint":{"type":"object","properties":{"status":{"type":"string","enum":["open","in_progress","waiting","resolved","closed"]},"receivedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"resolvedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"reopenedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"reopenCount":{"type":"integer","minimum":0,"maximum":100},"problemAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]}},"required":["status","receivedAt"],"additionalProperties":false},"reply":{"type":"string","minLength":1,"maxLength":1000},"reference":{"type":"string","minLength":1,"maxLength":64},"lang":{"default":"ar","type":"string","enum":["en","ar"]}},"required":["preset","complaint"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cst/preset":{"get":{"tags":["gov"],"summary":"The telecom complaints preset applied to the organisation (or null), whether the worker sends the reference messages, checks the filing window and reopens after \"not solved\" on this server, and how many of each it recorded (counts only); whole-organisation access only","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdGovCstPreset","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"govCstState"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["gov"],"summary":"Remove the applied telecom complaints preset: the automatic messages, filing checks and reopens stop; the SLA settings stay as they are; audited; 404 when none is applied","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdGovCstPreset","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cst/preset/apply":{"post":{"tags":["gov"],"summary":"Apply the telecom complaints preset (not approved by any regulator): stores the preview options and the optional problem-date question once the five confirmed numbers equal the preview (else 400 GOV_SETTINGS_NOT_CONFIRMED), and answers the SLA calendar, targets and ladder the screen then sends to the SLA routes; audited; whole-organisation access only","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdGovCstPresetApply","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"govCstApplied"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"preset":{"type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"dayStart":{"type":"integer","minimum":0,"maximum":1440},"dayEnd":{"type":"integer","minimum":0,"maximum":1440},"ramadan":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1440},"end":{"type":"integer","minimum":0,"maximum":1440}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"days":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"kind":{"type":"string","enum":["holiday","ramadan","workday"]},"name":{"default":"","type":"string","maxLength":80}},"required":["date","kind"],"additionalProperties":false}},"settings":{"type":"object","properties":{"resolveDays":{"type":"integer","minimum":1,"maximum":60},"acknowledgeDays":{"type":"integer","minimum":1,"maximum":30},"filingWindowDays":{"type":"integer","minimum":1,"maximum":365},"reopenWindowDays":{"type":"integer","minimum":1,"maximum":90},"maxReopens":{"type":"integer","minimum":0,"maximum":10}},"additionalProperties":false},"problemDateQuestionId":{"anyOf":[{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,100}$"},{"type":"null"}]}},"required":["unitId"],"additionalProperties":false},"confirmedSettings":{"type":"object","properties":{"resolveDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"acknowledgeDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"filingWindowDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reopenWindowDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxReopens":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["resolveDays","acknowledgeDays","filingWindowDays","reopenWindowDays","maxReopens"],"additionalProperties":false}},"required":["preset","confirmedSettings"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/cst/preset/events":{"get":{"tags":["gov"],"summary":"The recent automatic actions of the telecom preset, newest first: reference messages, complaints filed after the window and reopens after \"not solved\", with the ticket reference (never the message text); whole-organisation access only","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdGovCstPresetEvents","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":1,"maximum":100}}],"x-sayvara-contract":{"response":"govCstEvents"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/patient":{"get":{"tags":["gov"],"summary":"The patient experience pack: four survey templates, the six languages with their review labels (Urdu, Hindi, Tagalog and Bengali are machine translations that need review) and the default nurse-manager alert rules","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovPresetsPatient","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/patient/preview":{"post":{"tags":["gov"],"summary":"Preview one patient survey: the Arabic and English survey definition for the survey builder, the texts of the languages asked for with their review labels, and the checked alert rules; nothing is stored","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovPresetsPatientPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"kind":{"type":"string","enum":["inpatient","outpatient","emergency","primary_care"]},"langs":{"minItems":1,"maxItems":6,"type":"array","items":{"type":"string","enum":["ar","en","ur","hi","tl","bn"]}},"rules":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":150},"ar":{"type":"string","minLength":1,"maxLength":150}},"required":["en","ar"],"additionalProperties":false},"severity":{"type":"string","enum":["warning","critical"]},"kinds":{"minItems":1,"maxItems":4,"type":"array","items":{"type":"string","enum":["inpatient","outpatient","emergency","primary_care"]}},"when":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"score"},"questionIds":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","maxLength":40}},"atOrBelow":{"type":"integer","minimum":1,"maximum":4}},"required":["type","questionIds","atOrBelow"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"words"},"questionId":{"type":"string","maxLength":40},"words":{"type":"object","properties":{"en":{"maxItems":100,"type":"array","items":{"type":"string","minLength":2,"maxLength":60}},"ar":{"maxItems":100,"type":"array","items":{"type":"string","minLength":2,"maxLength":60}}},"required":["en","ar"],"additionalProperties":false}},"required":["type","questionId","words"],"additionalProperties":false}]}},"required":["id","label","severity","kinds","when"],"additionalProperties":false}},"defaultUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["kind"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/patient/alerts/check":{"post":{"tags":["gov"],"summary":"Run the nurse-manager alert rules on one response: the alerts it raises for the ward's nurse manager, critical first (safety words are checked in Arabic and English only; the comment text is never copied into an alert); nothing is sent","description":"Permission: `feedback.read`.","operationId":"postV1TenantsTenantIdGovPresetsPatientAlertsCheck","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"responseId":{"type":"string","minLength":1,"maxLength":64},"kind":{"type":"string","enum":["inpatient","outpatient","emergency","primary_care"]},"wardUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"answers":{"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"anyOf":[{"type":"number","minimum":0,"maximum":10},{"type":"string","maxLength":4000},{"type":"null"}]}},"rules":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":150},"ar":{"type":"string","minLength":1,"maxLength":150}},"required":["en","ar"],"additionalProperties":false},"severity":{"type":"string","enum":["warning","critical"]},"kinds":{"minItems":1,"maxItems":4,"type":"array","items":{"type":"string","enum":["inpatient","outpatient","emergency","primary_care"]}},"when":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"score"},"questionIds":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","maxLength":40}},"atOrBelow":{"type":"integer","minimum":1,"maximum":4}},"required":["type","questionIds","atOrBelow"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"words"},"questionId":{"type":"string","maxLength":40},"words":{"type":"object","properties":{"en":{"maxItems":100,"type":"array","items":{"type":"string","minLength":2,"maxLength":60}},"ar":{"maxItems":100,"type":"array","items":{"type":"string","minLength":2,"maxLength":60}}},"required":["en","ar"],"additionalProperties":false}},"required":["type","questionId","words"],"additionalProperties":false}]}},"required":["id","label","severity","kinds","when"],"additionalProperties":false}},"defaultUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["responseId","kind","wardUnitId","answers"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/patient/rules":{"get":{"tags":["gov"],"summary":"The nurse-manager alert rules saved for the organisation (or the starting rules when none are saved), the surveys they run on, the default unit and card language, whether this server sends the alerts on its own, and alert counts; whole-organisation access only","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovPresetsPatientRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gov"],"summary":"Save the nurse-manager alert rules: the rules (score at or below a threshold, or words in the comment), each rule's Teams and Slack channels, the surveys they run on with the patient survey kind of each (a survey keeps the time it was first linked; earlier responses never alert), the unit for responses without a ward and the card language; audited; whole-organisation access only","description":"Permission: `policy.manage`.","operationId":"putV1TenantsTenantIdGovPresetsPatientRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"rules":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":150},"ar":{"type":"string","minLength":1,"maxLength":150}},"required":["en","ar"],"additionalProperties":false},"severity":{"type":"string","enum":["warning","critical"]},"kinds":{"minItems":1,"maxItems":4,"type":"array","items":{"type":"string","enum":["inpatient","outpatient","emergency","primary_care"]}},"when":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"score"},"questionIds":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","maxLength":40}},"atOrBelow":{"type":"integer","minimum":1,"maximum":4}},"required":["type","questionIds","atOrBelow"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"words"},"questionId":{"type":"string","maxLength":40},"words":{"type":"object","properties":{"en":{"maxItems":100,"type":"array","items":{"type":"string","minLength":2,"maxLength":60}},"ar":{"maxItems":100,"type":"array","items":{"type":"string","minLength":2,"maxLength":60}}},"required":["en","ar"],"additionalProperties":false}},"required":["type","questionId","words"],"additionalProperties":false}]},"targets":{"minItems":1,"maxItems":2,"type":"array","items":{"type":"string","enum":["teams","slack"]}}},"required":["id","label","severity","kinds","when"],"additionalProperties":false}},"surveys":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string","enum":["inpatient","outpatient","emergency","primary_care"]}},"required":["surveyId","kind"],"additionalProperties":false}},"defaultUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"lang":{"type":"string","enum":["ar","en"]}},"required":["rules","surveys","defaultUnitId","lang"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["gov"],"summary":"Remove the saved nurse-manager alert rules: no new alert is raised; the alerts already recorded stay; audited; 404 when none are saved","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdGovPresetsPatientRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/patient/alerts":{"get":{"tags":["gov"],"summary":"The most recent nurse-manager alerts raised from real responses, newest first, with how each was delivered (sent, waiting, not delivered and why); comment text is never stored in an alert; whole-organisation access only","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovPresetsPatientAlerts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/ecommerce/preview":{"post":{"tags":["gov"],"summary":"Preview the delivery and return check-in preset (not approved by any regulator; it never stops a customer complaining to the authorities): the WhatsApp messages, timing and quiet hours, and the round-the-clock 72-hour SLA to apply; nothing is stored","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovPresetsEcommercePreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"settings":{"type":"object","properties":{"checkInDelayHours":{"type":"integer","minimum":1,"maximum":168},"clockHours":{"type":"integer","minimum":1,"maximum":168},"dueSoonHours":{"type":"integer","minimum":1,"maximum":167},"firstReplyHours":{"type":"integer","minimum":1,"maximum":72},"afterReturns":{"type":"boolean"},"quietHours":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1439},"end":{"type":"integer","minimum":0,"maximum":1439}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false}},"required":["unitId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/ecommerce/plan":{"post":{"tags":["gov"],"summary":"When and what the check-in for one delivery or return would send (null when returns are turned off); nothing is sent","description":"Permission: `feedback.read`.","operationId":"postV1TenantsTenantIdGovPresetsEcommercePlan","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"preset":{"type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"settings":{"type":"object","properties":{"checkInDelayHours":{"type":"integer","minimum":1,"maximum":168},"clockHours":{"type":"integer","minimum":1,"maximum":168},"dueSoonHours":{"type":"integer","minimum":1,"maximum":167},"firstReplyHours":{"type":"integer","minimum":1,"maximum":72},"afterReturns":{"type":"boolean"},"quietHours":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1439},"end":{"type":"integer","minimum":0,"maximum":1439}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false}},"required":["unitId"],"additionalProperties":false},"event":{"type":"object","properties":{"orderId":{"type":"string","pattern":"^[A-Za-z0-9._#/-]{1,64}$"},"kind":{"type":"string","enum":["delivered","returned"]},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"lang":{"default":"ar","type":"string","enum":["en","ar"]}},"required":["orderId","kind","at"],"additionalProperties":false}},"required":["preset","event"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/presets/ecommerce/reply":{"post":{"tags":["gov"],"summary":"What a check-in reply means (ok, problem, unclear), the answer to send and, for a problem with a contact, the ticket request with its 72-hour deadline (intake state preview). With open true (needs tickets.write and the contact) the ticket is opened through the ticket intake seam, once per order and event (intake opened with its ticket id, or failed with the seam's code: not_entitled, invalid, unavailable); audited","description":"Permission: `feedback.read`.","operationId":"postV1TenantsTenantIdGovPresetsEcommerceReply","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"preset":{"type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"settings":{"type":"object","properties":{"checkInDelayHours":{"type":"integer","minimum":1,"maximum":168},"clockHours":{"type":"integer","minimum":1,"maximum":168},"dueSoonHours":{"type":"integer","minimum":1,"maximum":167},"firstReplyHours":{"type":"integer","minimum":1,"maximum":72},"afterReturns":{"type":"boolean"},"quietHours":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1439},"end":{"type":"integer","minimum":0,"maximum":1439}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false}},"required":["unitId"],"additionalProperties":false},"event":{"type":"object","properties":{"orderId":{"type":"string","pattern":"^[A-Za-z0-9._#/-]{1,64}$"},"kind":{"type":"string","enum":["delivered","returned"]},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"lang":{"default":"ar","type":"string","enum":["en","ar"]}},"required":["orderId","kind","at"],"additionalProperties":false},"reply":{"type":"string","minLength":1,"maxLength":4000},"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"open":{"default":false,"type":"boolean"}},"required":["preset","event","reply"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/ecom/preset":{"get":{"tags":["gov"],"summary":"The delivery and return check-in applied to the organisation (or null) with its settings, whether store events are recorded and the WhatsApp check-ins can go out on this server, the counts (pending, sent, not sent, answered all good or problem, tickets opened) and the 20 most recent check-ins (the order number the customer knows, event, state and why not sent, outcome, ticket and why not opened; never the customer); whole-organisation access only","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovEcomPreset","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["gov"],"summary":"Remove the applied delivery and return check-in: no new check-in is recorded or sent and taps on earlier ones are no longer taken; the record stays; audited; 404 when none is applied","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdGovEcomPreset","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/ecom/preset/apply":{"post":{"tags":["gov"],"summary":"Apply the delivery and return check-in: stores the preview options once the confirmed delay and ticket clock equal the preview (else 400 GOV_SETTINGS_NOT_CONFIRMED); audited; whole-organisation access only","description":"Permission: `policy.manage`.","operationId":"postV1TenantsTenantIdGovEcomPresetApply","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"preset":{"type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"settings":{"type":"object","properties":{"checkInDelayHours":{"type":"integer","minimum":1,"maximum":168},"clockHours":{"type":"integer","minimum":1,"maximum":168},"dueSoonHours":{"type":"integer","minimum":1,"maximum":167},"firstReplyHours":{"type":"integer","minimum":1,"maximum":72},"afterReturns":{"type":"boolean"},"quietHours":{"anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":1439},"end":{"type":"integer","minimum":0,"maximum":1439}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false}},"required":["unitId"],"additionalProperties":false},"confirmed":{"type":"object","properties":{"checkInDelayHours":{"type":"integer","minimum":1,"maximum":168},"clockHours":{"type":"integer","minimum":1,"maximum":168}},"required":["checkInDelayHours","clockHours"],"additionalProperties":false}},"required":["preset","confirmed"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/risk/customers":{"get":{"tags":["stats"],"summary":"Customers ranked by churn risk (0-100) with band and top reasons in English and Arabic","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsRiskCustomers","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"asOf","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"lookbackDays","in":"query","required":false,"schema":{"default":90,"type":"integer","minimum":7,"maximum":365}},{"name":"repeatWindowDays","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":1,"maximum":90}},{"name":"atRiskHours","in":"query","required":false,"schema":{"default":24,"type":"integer","minimum":1,"maximum":168}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"minBand","in":"query","required":false,"schema":{"default":"low","type":"string","enum":["low","medium","high","critical"]}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/risk/complaints":{"get":{"tags":["stats"],"summary":"Open complaints ranked by escalation risk (0-100) with band and top reasons in English and Arabic","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsRiskComplaints","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"asOf","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"lookbackDays","in":"query","required":false,"schema":{"default":90,"type":"integer","minimum":7,"maximum":365}},{"name":"repeatWindowDays","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":1,"maximum":90}},{"name":"atRiskHours","in":"query","required":false,"schema":{"default":24,"type":"integer","minimum":1,"maximum":168}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"minBand","in":"query","required":false,"schema":{"default":"low","type":"string","enum":["low","medium","high","critical"]}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/risk/calibration":{"get":{"tags":["stats"],"summary":"Back-test of the risk bands on past data: outcome rate per band with interval and AUC","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsRiskCalibration","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"query","required":false,"schema":{"default":"complaints","type":"string","enum":["complaints","customers"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"lookbackDays","in":"query","required":false,"schema":{"default":90,"type":"integer","minimum":7,"maximum":365}},{"name":"repeatWindowDays","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":1,"maximum":90}},{"name":"atRiskHours","in":"query","required":false,"schema":{"default":24,"type":"integer","minimum":1,"maximum":168}},{"name":"horizonDays","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":7,"maximum":180}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"confidence","in":"query","required":false,"schema":{"default":0.95,"type":"number"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/risk/contacts":{"get":{"tags":["stats"],"summary":"Contacts ranked by repeat-complaint or churn risk (published logistic weights), each factor with its contribution in English and Arabic","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsRiskContacts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"asOf","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"lookbackDays","in":"query","required":false,"schema":{"default":180,"type":"integer","minimum":30,"maximum":365}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"flag","in":"query","required":false,"schema":{"default":"churn","type":"string","enum":["repeat_complaint","churn"]}},{"name":"minBand","in":"query","required":false,"schema":{"default":"medium","type":"string","enum":["low","medium","high"]}},{"name":"includeInsufficient","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/risk/contacts/{contactId}":{"get":{"tags":["stats"],"summary":"Repeat-complaint and churn risk of one contact with the factors behind each, or \"not enough history\"","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsRiskContactsContactId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"asOf","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"lookbackDays","in":"query","required":false,"schema":{"default":180,"type":"integer","minimum":30,"maximum":365}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/league":{"get":{"tags":["stats"],"summary":"League table in the caller scope: each unit against its siblings, region and organisation median, with goals and traffic lights (last 90 days by default)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsLeague","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"level","in":"query","required":false,"schema":{"default":"branch","type":"string","enum":["region","branch","team"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"minResponses","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":10,"maximum":10000}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/benchmarks":{"get":{"tags":["stats"],"summary":"Benchmarks in the caller scope: the league table of the period with the change of each unit on the period before (95 %, Holm-adjusted), and the whole scope against the organisation goal","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsBenchmarks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"level","in":"query","required":false,"schema":{"default":"branch","type":"string","enum":["region","branch","team"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"minResponses","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":10,"maximum":10000}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/goals":{"get":{"tags":["stats"],"summary":"Score goals of the organisation and of the units in scope","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsGoals","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"metric","in":"query","required":false,"schema":{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^m:[a-z][a-z0-9_]{1,39}$"}]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["stats"],"summary":"Set the score goal of a unit or of the whole organisation","description":"Permission: `goals.manage`.","operationId":"putV1TenantsTenantIdStatsGoals","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"metric":{"anyOf":[{"type":"string","enum":["nps","csat","ces"]},{"type":"string","pattern":"^m:[a-z][a-z0-9_]{1,39}$"}]},"target":{"type":"number"},"amberMargin":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]}},"required":["orgUnitId","metric","target"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/goals/{goalId}":{"delete":{"tags":["stats"],"summary":"Remove a score goal","description":"Permission: `goals.manage`.","operationId":"deleteV1TenantsTenantIdStatsGoalsGoalId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"goalId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/cx-index":{"get":{"tags":["stats"],"summary":"Sayvara Saudi CX Index: whether the organisation takes part, the latest published quarterly edition (aggregate sector cells of at least 5 organisations) and, for members who see the whole organisation while it takes part, its own position","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsCxIndex","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/cx-index/opt-in":{"put":{"tags":["stats"],"summary":"Join the Sayvara Saudi CX Index with a sector, change sector, or leave (Saudi organisations only; audited; leaving deletes the organisation own quarter scores)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdStatsCxIndexOptIn","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","oneOf":[{"type":"object","properties":{"optedIn":{"type":"boolean","const":true},"sector":{"type":"string","enum":["government","banking","insurance","telecom","retail","ecommerce","hospitality","food_beverage","healthcare","education","transport","utilities","real_estate","automotive","other"]}},"required":["optedIn","sector"],"additionalProperties":false},{"type":"object","properties":{"optedIn":{"type":"boolean","const":false}},"required":["optedIn"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/cx-index/edition":{"get":{"tags":["stats"],"summary":"One published quarterly edition of the Sayvara Saudi CX Index (the latest without quarter); null before the first","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsCxIndexEdition","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"quarter","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/cx-index/position":{"get":{"tags":["stats"],"summary":"The organisation own quarter score on one metric against its sector cell (only while it takes part; members who see the whole organisation)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsCxIndexPosition","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"metric","in":"query","required":true,"schema":{"type":"string","enum":["nps","csat","ces"]}},{"name":"quarter","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-Q[1-4]$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/dashboards/templates":{"get":{"tags":["stats"],"summary":"Ready dashboards per role (executive, branch manager, CX analyst, agent) and sector","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsDashboardsTemplates","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"role","in":"query","required":false,"schema":{"type":"string","enum":["exec","branch_manager","cx_analyst","agent"]}},{"name":"sector","in":"query","required":false,"schema":{"type":"string","enum":["retail","bank","gov","health"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/dashboards":{"get":{"tags":["stats"],"summary":"Dashboards the caller owns or that are shared with them, within their scope","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsDashboards","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Save a dashboard from a layout or a ready template, private, shared with colleagues or the tenant","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdStatsDashboards","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"templateKey":{"type":"string","pattern":"^[a-z_]+\\.[a-z_]+$"},"layout":{"type":"object","properties":{"widgets":{"minItems":1,"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"title":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"x":{"type":"integer","minimum":0,"maximum":11},"y":{"type":"integer","minimum":0,"maximum":200},"w":{"type":"integer","minimum":1,"maximum":12},"h":{"type":"integer","minimum":1,"maximum":8},"query":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"kpi"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"trend"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"bucket":{"type":"string","enum":["day","week","month"]}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"breakdown"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"by":{"type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"limit":{"type":"integer","minimum":1,"maximum":50},"order":{"type":"string","enum":["best","worst"]}},"required":["kind","metric","by","limit","order"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"distribution"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"themes"},"limit":{"type":"integer","minimum":1,"maximum":25},"sentiment":{"type":"string","enum":["any","negative","positive"]}},"required":["kind","limit","sentiment"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"volume"},"byChannel":{"type":"boolean"}},"required":["kind","byChannel"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"insight_card"},"cardId":{"type":"string","maxLength":240,"pattern":"^(new_theme|rising_theme|root_cause|concentration|negative_theme|urgent_comments|score_out_of_band):\\S{1,200}$"}},"required":["kind","cardId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"crosstab"},"rows":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"cols":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"confidence":{"type":"number"},"correction":{"type":"string","enum":["none","bonferroni","holm","bh"]}},"required":["kind","rows","cols"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"key_drivers"},"metric":{"type":"string","enum":["nps","csat","ces"]},"source":{"type":"string","enum":["questions","themes"]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"top":{"type":"integer","minimum":1,"maximum":15}},"required":["kind","metric","source","top"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"period_compare"},"metric":{"type":"string","enum":["nps","csat","ces"]},"compare":{"type":"string","enum":["previous_period","previous_year"]},"confidence":{"type":"number"}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"control_chart"},"metric":{"type":"string","enum":["nps","csat","ces"]},"bucket":{"type":"string","enum":["day"]},"measure":{"type":"string","enum":["score","share"]},"horizon":{"type":"integer","minimum":0,"maximum":30},"confidence":{"type":"number"}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"sample_check"},"metric":{"type":"string","enum":["nps","csat","ces"]},"by":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"target":{"type":"number","minimum":0.5,"maximum":50},"confidence":{"type":"number"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"limit":{"type":"integer","minimum":1,"maximum":50}},"required":["kind","metric","by","target","limit"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"kpi_trend"},"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"grain":{"type":"string","enum":["day","week","month","quarter"]},"periods":{"type":"integer","minimum":2,"maximum":92}},"required":["kind","key"],"additionalProperties":false}]}},"required":["id","title","x","y","w","h","query"],"additionalProperties":false}}},"required":["widgets"],"additionalProperties":false},"period":{"type":"object","properties":{"preset":{"default":"last_30_days","type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","this_quarter","last_quarter","custom"]},"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"compare":{"default":"previous_period","type":"string","enum":["previous_period","previous_year","none"]},"offsetMinutes":{"default":180,"type":"integer","minimum":-720,"maximum":840}},"additionalProperties":false},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"visibility":{"default":"private","type":"string","enum":["private","members","tenant"]},"sharedWith":{"default":[],"maxItems":200,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/dashboards/preview":{"post":{"tags":["stats"],"summary":"Widget results of an unsaved layout in the caller scope (the builder preview), statistics-result widgets included","description":"Permission: `dashboards.read`.","operationId":"postV1TenantsTenantIdStatsDashboardsPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"layout":{"type":"object","properties":{"widgets":{"minItems":1,"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"title":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"x":{"type":"integer","minimum":0,"maximum":11},"y":{"type":"integer","minimum":0,"maximum":200},"w":{"type":"integer","minimum":1,"maximum":12},"h":{"type":"integer","minimum":1,"maximum":8},"query":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"kpi"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"trend"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"bucket":{"type":"string","enum":["day","week","month"]}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"breakdown"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"by":{"type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"limit":{"type":"integer","minimum":1,"maximum":50},"order":{"type":"string","enum":["best","worst"]}},"required":["kind","metric","by","limit","order"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"distribution"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"themes"},"limit":{"type":"integer","minimum":1,"maximum":25},"sentiment":{"type":"string","enum":["any","negative","positive"]}},"required":["kind","limit","sentiment"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"volume"},"byChannel":{"type":"boolean"}},"required":["kind","byChannel"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"insight_card"},"cardId":{"type":"string","maxLength":240,"pattern":"^(new_theme|rising_theme|root_cause|concentration|negative_theme|urgent_comments|score_out_of_band):\\S{1,200}$"}},"required":["kind","cardId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"crosstab"},"rows":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"cols":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"confidence":{"type":"number"},"correction":{"type":"string","enum":["none","bonferroni","holm","bh"]}},"required":["kind","rows","cols"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"key_drivers"},"metric":{"type":"string","enum":["nps","csat","ces"]},"source":{"type":"string","enum":["questions","themes"]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"top":{"type":"integer","minimum":1,"maximum":15}},"required":["kind","metric","source","top"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"period_compare"},"metric":{"type":"string","enum":["nps","csat","ces"]},"compare":{"type":"string","enum":["previous_period","previous_year"]},"confidence":{"type":"number"}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"control_chart"},"metric":{"type":"string","enum":["nps","csat","ces"]},"bucket":{"type":"string","enum":["day"]},"measure":{"type":"string","enum":["score","share"]},"horizon":{"type":"integer","minimum":0,"maximum":30},"confidence":{"type":"number"}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"sample_check"},"metric":{"type":"string","enum":["nps","csat","ces"]},"by":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"target":{"type":"number","minimum":0.5,"maximum":50},"confidence":{"type":"number"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"limit":{"type":"integer","minimum":1,"maximum":50}},"required":["kind","metric","by","target","limit"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"kpi_trend"},"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"grain":{"type":"string","enum":["day","week","month","quarter"]},"periods":{"type":"integer","minimum":2,"maximum":92}},"required":["kind","key"],"additionalProperties":false}]}},"required":["id","title","x","y","w","h","query"],"additionalProperties":false}}},"required":["widgets"],"additionalProperties":false},"period":{"default":{"preset":"last_30_days","compare":"previous_period","offsetMinutes":180},"type":"object","properties":{"preset":{"default":"last_30_days","type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","this_quarter","last_quarter","custom"]},"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"compare":{"default":"previous_period","type":"string","enum":["previous_period","previous_year","none"]},"offsetMinutes":{"default":180,"type":"integer","minimum":-720,"maximum":840}},"additionalProperties":false},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["layout"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/dashboards/{dashboardId}":{"get":{"tags":["stats"],"summary":"One dashboard: its layout, default period and sharing","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsDashboardsDashboardId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["stats"],"summary":"Change a dashboard (owner, or an organisation-wide manager for a shared one); a layout is refused with 409 STATS_DASHBOARD_BUILDER_LAYOUT on a dashboard made in the dashboard builder","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdStatsDashboardsDashboardId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"layout":{"type":"object","properties":{"widgets":{"minItems":1,"maxItems":24,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,32}$"},"title":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"x":{"type":"integer","minimum":0,"maximum":11},"y":{"type":"integer","minimum":0,"maximum":200},"w":{"type":"integer","minimum":1,"maximum":12},"h":{"type":"integer","minimum":1,"maximum":8},"query":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"kpi"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"trend"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"bucket":{"type":"string","enum":["day","week","month"]}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"breakdown"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]},"by":{"type":"string","enum":["orgUnit","channel","survey","lang","sentiment"]},"limit":{"type":"integer","minimum":1,"maximum":50},"order":{"type":"string","enum":["best","worst"]}},"required":["kind","metric","by","limit","order"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"distribution"},"metric":{"type":"string","enum":["nps","csat","ces","fcr"]}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"themes"},"limit":{"type":"integer","minimum":1,"maximum":25},"sentiment":{"type":"string","enum":["any","negative","positive"]}},"required":["kind","limit","sentiment"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"volume"},"byChannel":{"type":"boolean"}},"required":["kind","byChannel"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"insight_card"},"cardId":{"type":"string","maxLength":240,"pattern":"^(new_theme|rising_theme|root_cause|concentration|negative_theme|urgent_comments|score_out_of_band):\\S{1,200}$"}},"required":["kind","cardId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"crosstab"},"rows":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"cols":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"confidence":{"type":"number"},"correction":{"type":"string","enum":["none","bonferroni","holm","bh"]}},"required":["kind","rows","cols"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"key_drivers"},"metric":{"type":"string","enum":["nps","csat","ces"]},"source":{"type":"string","enum":["questions","themes"]},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"top":{"type":"integer","minimum":1,"maximum":15}},"required":["kind","metric","source","top"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"period_compare"},"metric":{"type":"string","enum":["nps","csat","ces"]},"compare":{"type":"string","enum":["previous_period","previous_year"]},"confidence":{"type":"number"}},"required":["kind","metric"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"control_chart"},"metric":{"type":"string","enum":["nps","csat","ces"]},"bucket":{"type":"string","enum":["day"]},"measure":{"type":"string","enum":["score","share"]},"horizon":{"type":"integer","minimum":0,"maximum":30},"confidence":{"type":"number"}},"required":["kind","metric","bucket"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"sample_check"},"metric":{"type":"string","enum":["nps","csat","ces"]},"by":{"anyOf":[{"type":"string","enum":["orgUnit","channel","lang","sentiment","survey","month","week","npsGroup","csatGroup","cesGroup","theme"]},{"type":"string","pattern":"^answer:[A-Za-z0-9_-]{1,64}$"}]},"target":{"type":"number","minimum":0.5,"maximum":50},"confidence":{"type":"number"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"limit":{"type":"integer","minimum":1,"maximum":50}},"required":["kind","metric","by","target","limit"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"kpi_trend"},"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"grain":{"type":"string","enum":["day","week","month","quarter"]},"periods":{"type":"integer","minimum":2,"maximum":92}},"required":["kind","key"],"additionalProperties":false}]}},"required":["id","title","x","y","w","h","query"],"additionalProperties":false}}},"required":["widgets"],"additionalProperties":false},"period":{"type":"object","properties":{"preset":{"default":"last_30_days","type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","this_quarter","last_quarter","custom"]},"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"compare":{"default":"previous_period","type":"string","enum":["previous_period","previous_year","none"]},"offsetMinutes":{"default":180,"type":"integer","minimum":-720,"maximum":840}},"additionalProperties":false},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"visibility":{"type":"string","enum":["private","members","tenant"]},"sharedWith":{"maxItems":200,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["stats"],"summary":"Remove a dashboard","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdStatsDashboardsDashboardId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/dashboards/{dashboardId}/data":{"get":{"tags":["stats"],"summary":"Widget results with period comparison and a data-as-of stamp (pinned insight cards re-read; key drivers, comparison, control chart and sample check computed for the period), in the caller scope; on a dashboard made in the dashboard builder, text notes get no result","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsDashboardsDashboardIdData","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"preset","in":"query","required":false,"schema":{"type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","this_quarter","last_quarter","custom"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"compare","in":"query","required":false,"schema":{"type":"string","enum":["previous_period","previous_year","none"]}},{"name":"offsetMinutes","in":"query","required":false,"schema":{"type":"integer","minimum":-720,"maximum":840}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/board-packs":{"get":{"tags":["stats"],"summary":"Monthly board pack schedules in the caller scope","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdStatsBoardPacks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Set up a monthly board pack (editable PPTX and PDF, Arabic and English), with a preview","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdStatsBoardPacks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"leadMetric":{"default":"nps","type":"string","enum":["nps","csat","ces"]},"langs":{"default":["ar","en"],"minItems":1,"maxItems":2,"type":"array","items":{"type":"string","enum":["ar","en"]}},"formats":{"default":["pptx","pdf"],"minItems":1,"maxItems":2,"type":"array","items":{"type":"string","enum":["pptx","pdf"]}},"recipientUserIds":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"dayOfMonth":{"default":3,"type":"integer","minimum":1,"maximum":28},"hourLocal":{"default":8,"type":"integer","minimum":0,"maximum":23},"orgUnitId":{"default":null,"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"surveyId":{"default":null,"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"enabled":{"default":true,"type":"boolean"}},"required":["name","recipientUserIds"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/board-packs/preview":{"get":{"tags":["stats"],"summary":"Build a board pack now with templated commentary: numbers, print page or PPTX","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdStatsBoardPacksPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"month","in":"query","required":false,"schema":{"type":"string","pattern":"^[0-9]{4}-(0[1-9]|1[0-2])$"}},{"name":"lang","in":"query","required":false,"schema":{"default":"ar","type":"string","enum":["ar","en"]}},{"name":"format","in":"query","required":false,"schema":{"default":"json","type":"string","enum":["json","html","pptx"]}},{"name":"leadMetric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/board-packs/narrative":{"post":{"tags":["stats"],"summary":"Fact-grounded narrative of a board pack built now: AI wording checked number by number against the facts, or the facts only","description":"Permission: `feedback.export`.","operationId":"postV1TenantsTenantIdStatsBoardPacksNarrative","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"month":{"type":"string","pattern":"^[0-9]{4}-(0[1-9]|1[0-2])$"},"lang":{"default":"ar","type":"string","enum":["ar","en"]},"leadMetric":{"default":"nps","type":"string","enum":["nps","csat","ces"]},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/board-packs/options":{"get":{"tags":["stats"],"summary":"What a board pack may be set up for: tenant-wide or not, the units in the caller scope and the members who may receive it","description":"Permission: `surveys.write`.","operationId":"getV1TenantsTenantIdStatsBoardPacksOptions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/board-packs/{packId}":{"get":{"tags":["stats"],"summary":"One board pack schedule","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdStatsBoardPacksPackId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"packId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["stats"],"summary":"Change a board pack schedule","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdStatsBoardPacksPackId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"packId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"leadMetric":{"type":"string","enum":["nps","csat","ces"]},"langs":{"minItems":1,"maxItems":2,"type":"array","items":{"type":"string","enum":["ar","en"]}},"formats":{"minItems":1,"maxItems":2,"type":"array","items":{"type":"string","enum":["pptx","pdf"]}},"recipientUserIds":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"dayOfMonth":{"type":"integer","minimum":1,"maximum":28},"hourLocal":{"type":"integer","minimum":0,"maximum":23},"orgUnitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"surveyId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"enabled":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["stats"],"summary":"Remove a board pack schedule and its run history","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdStatsBoardPacksPackId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"packId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/board-packs/{packId}/runs":{"get":{"tags":["stats"],"summary":"The latest monthly runs of a board pack: status, files and how the commentary was written","description":"Permission: `feedback.export`.","operationId":"getV1TenantsTenantIdStatsBoardPacksPackIdRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"packId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/silent":{"get":{"tags":["text-analytics"],"summary":"Estimated scores of customers who had conversations but did not answer, as a roll-up next to those who answered (estimates, with the method)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsSilent","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/silent/customers":{"get":{"tags":["text-analytics"],"summary":"Silent customers by opaque contact id, lowest estimated score first, with range, confidence and reasons","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsSilentCustomers","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/runs/{runId}/link":{"get":{"tags":["ex"],"summary":"Staff eNPS and pulse items against customer scores per unit, from shown (k-anonymous) groups only","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdExRunsRunIdLink","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"mode","in":"query","required":false,"schema":{"default":"same","type":"string","enum":["same","next"]}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"minCustomers","in":"query","required":false,"schema":{"type":"integer","minimum":10,"maximum":10000}},{"name":"unitIds","in":"query","required":false,"schema":{"type":"string","maxLength":7400}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/reviews/template":{"get":{"tags":["ex"],"summary":"The ready 360 framework: six competencies in Arabic and English","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdExReviewsTemplate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"opensAt","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/reviews":{"get":{"tags":["ex"],"summary":"360 review cycles (archived ones with include=all)","description":"Permission: `members.write`.","operationId":"getV1TenantsTenantIdExReviews","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","all"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["ex"],"summary":"Set up a 360 review cycle (in set-up), from the ready framework or written in full","description":"Permission: `members.write`.","operationId":"postV1TenantsTenantIdExReviews","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"template":{"type":"string","const":"default"},"opensAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false}},"required":["template","opensAt"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false},"competencies":{"minItems":1,"maxItems":8,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false},"items":{"minItems":1,"maxItems":6,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"text":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false}},"required":["key","text"],"additionalProperties":false}}},"required":["key","name","items"],"additionalProperties":false}},"minGroup":{"type":"integer","minimum":5,"maximum":50},"opensAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"closesAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"shareWithManager":{"type":"boolean"},"coach":{"type":"boolean"}},"required":["name","competencies","minGroup","opensAt","closesAt","shareWithManager","coach"],"additionalProperties":false}]}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/reviews/{cycleId}":{"get":{"tags":["ex"],"summary":"One cycle with its subjects, rater lists, whole-cycle participation and rater message counts","description":"Permission: `members.write`.","operationId":"getV1TenantsTenantIdExReviewsCycleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cycleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["ex"],"summary":"Save the whole cycle before it opens; send the version you loaded","description":"Permission: `members.write`.","operationId":"putV1TenantsTenantIdExReviewsCycleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cycleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false},"competencies":{"minItems":1,"maxItems":8,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"name":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false},"items":{"minItems":1,"maxItems":6,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"text":{"type":"object","properties":{"ar":{"type":"string","maxLength":300},"en":{"type":"string","maxLength":300}},"additionalProperties":false}},"required":["key","text"],"additionalProperties":false}}},"required":["key","name","items"],"additionalProperties":false}},"minGroup":{"type":"integer","minimum":5,"maximum":50},"opensAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"closesAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"shareWithManager":{"type":"boolean"},"coach":{"type":"boolean"},"version":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["name","competencies","minGroup","opensAt","closesAt","shareWithManager","coach","version"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["ex"],"summary":"Move a cycle to nominating, open, closed or archived","description":"Permission: `members.write`.","operationId":"patchV1TenantsTenantIdExReviewsCycleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cycleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"status":{"type":"string","enum":["draft","nominating","open","closed","archived"]}},"required":["status"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/reviews/{cycleId}/subjects":{"post":{"tags":["ex"],"summary":"Add a person to review, with their manager as a rater","description":"Permission: `members.write`.","operationId":"postV1TenantsTenantIdExReviewsCycleIdSubjects","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cycleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"memberId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"managerMemberId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["memberId"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/reviews/subjects/{subjectId}/raters":{"put":{"tags":["ex"],"summary":"Replace a subject's rater list (waits for approval again)","description":"Permission: `members.write`.","operationId":"putV1TenantsTenantIdExReviewsSubjectsSubjectIdRaters","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subjectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"raters":{"minItems":1,"maxItems":60,"type":"array","items":{"type":"object","properties":{"raterId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"role":{"type":"string","enum":["self","manager","peer","report","other"]}},"required":["raterId","role"],"additionalProperties":false}}},"required":["raters"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/reviews/subjects/{subjectId}/approve":{"post":{"tags":["ex"],"summary":"Approve a rater list (at least the minimum of raters besides the subject)","description":"Permission: `members.write`.","operationId":"postV1TenantsTenantIdExReviewsSubjectsSubjectIdApprove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subjectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/reviews/subjects/{subjectId}/report":{"get":{"tags":["ex"],"summary":"A subject's 360 report after the cycle closes, for the subject, HR and (when shared) their manager; small groups hidden","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdExReviewsSubjectsSubjectIdReport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subjectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/reviews/subjects/{subjectId}/coach":{"get":{"tags":["ex"],"summary":"The manager coach: areas to work on and to keep, with actions, from the shown report only","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdExReviewsSubjectsSubjectIdCoach","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subjectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"lang","in":"query","required":false,"schema":{"default":"ar","type":"string","enum":["ar","en"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/review-answer/form":{"post":{"tags":["ex"],"summary":"The statements behind a one-time 360 link (token in the body)","operationId":"postV1TenantsTenantIdExReviewAnswerForm","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","minLength":16,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ex/review-answer":{"post":{"tags":["ex"],"summary":"Answer a 360 review once with the one-time link; nothing about the rater is stored with the answer","operationId":"postV1TenantsTenantIdExReviewAnswer","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"token":{"type":"string","minLength":16,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"},"scores":{"type":"object","propertyNames":{"type":"string","maxLength":32},"additionalProperties":{"anyOf":[{"type":"number"},{"type":"string","maxLength":4}]}},"strengths":{"type":"string","maxLength":2000},"develop":{"type":"string","maxLength":2000}},"required":["token","scores"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/root-causes/codes":{"get":{"tags":["text-analytics"],"summary":"The organisation root-cause list in English and Arabic (a starter set on first use)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsRootCausesCodes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/root-causes/codes/{key}":{"put":{"tags":["text-analytics"],"summary":"Create or change one root-cause code (organisation-wide managers; deactivate instead of delete)","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdTextAnalyticsRootCausesCodesKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"labelEn":{"type":"string","minLength":1,"maxLength":80},"labelAr":{"type":"string","minLength":1,"maxLength":80},"descriptionEn":{"default":"","type":"string","maxLength":200},"descriptionAr":{"default":"","type":"string","maxLength":200},"base":{"type":"string","enum":["none","process","staff","product","system"]},"keywords":{"default":[],"maxItems":60,"type":"array","items":{"type":"string","minLength":1,"maxLength":60}},"active":{"default":true,"type":"boolean"},"sort":{"type":"integer","minimum":0,"maximum":100000}},"required":["labelEn","labelAr","base"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/root-causes/report":{"get":{"tags":["text-analytics"],"summary":"Confirmed root causes of resolved tickets by period and unit (last 90 days by default)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsRootCausesReport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"}},{"name":"granularity","in":"query","required":false,"schema":{"default":"week","type":"string","enum":["day","week","month"]}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"openedWithinDays","in":"query","required":false,"schema":{"default":180,"type":"integer","minimum":0,"maximum":366}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/root-causes/summary":{"get":{"tags":["text-analytics"],"summary":"Tickets opened in a period by root-cause category: closed and open, share, change on the previous period, top branches","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsRootCausesSummary","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/tickets/{ticketId}/root-cause":{"get":{"tags":["text-analytics"],"summary":"The root-cause suggestion and the confirmed code of a ticket","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsTicketsTicketIdRootCause","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["text-analytics"],"summary":"Confirm the root cause of a ticket on close, and what fixed it","description":"Permission: `tickets.write`.","operationId":"putV1TenantsTenantIdTextAnalyticsTicketsTicketIdRootCause","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,39}$"},"action":{"default":null,"anyOf":[{"type":"string","enum":["apology_call","explanation","refund","replacement","goodwill_credit","redo_service","technical_fix","staff_coaching","process_change","escalation","appointment","other"]},{"type":"null"}]}},"required":["code"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/tickets/{ticketId}/root-cause/suggest":{"post":{"tags":["text-analytics"],"summary":"Suggest a root-cause code from the ticket conversation, with confidence and reasons (a person confirms)","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsTicketsTicketIdRootCauseSuggest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"lang":{"default":"en","type":"string","enum":["ar","en"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/tickets/{ticketId}/next-best-action":{"get":{"tags":["text-analytics"],"summary":"What fixed similar closed tickets fastest, with the evidence (hidden below the minimum case count)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsTicketsTicketIdNextBestAction","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"days","in":"query","required":false,"schema":{"default":180,"type":"integer","minimum":30,"maximum":366}},{"name":"minCases","in":"query","required":false,"schema":{"default":5,"type":"integer","minimum":3,"maximum":100}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/tickets/{ticketId}/drafts":{"get":{"tags":["text-analytics"],"summary":"Suggested recovery replies of a ticket with every edit and who approved","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsTicketsTicketIdDrafts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["text-analytics"],"summary":"Write a suggested recovery reply in Arabic or English with AI (never sent without approval)","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsTicketsTicketIdDrafts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"lang":{"default":"ar","type":"string","enum":["ar","en"]}},"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/drafts/{draftId}":{"patch":{"tags":["text-analytics"],"summary":"Edit a suggested reply (a new version; the AI suggested reply is kept)","description":"Permission: `tickets.write`.","operationId":"patchV1TenantsTenantIdTextAnalyticsDraftsDraftId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":1000},"version":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["body","version"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/drafts/{draftId}/approve":{"post":{"tags":["text-analytics"],"summary":"Approve a suggested reply","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsDraftsDraftIdApprove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"version":{"type":"integer","minimum":1,"maximum":9007199254740991}},"required":["version"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/drafts/{draftId}/send":{"post":{"tags":["text-analytics"],"summary":"Send an approved suggested reply that is still waiting","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsDraftsDraftIdSend","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/drafts/{draftId}/discard":{"post":{"tags":["text-analytics"],"summary":"Discard a suggested reply","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsDraftsDraftIdDiscard","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/call":{"post":{"tags":["cati"],"summary":"Call the person you hold now; you see only a masked number","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiEntriesEntryIdCall","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiVoiceCall"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"maxSeconds":{"type":"integer","minimum":30,"maximum":7200}},"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/call/{callId}":{"get":{"tags":["cati"],"summary":"Where the call is: ringing, answered or how it ended, with talk time and recording state (off, consented, stored)","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiEntriesEntryIdCallCallId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"callId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiVoiceCall"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/call/{callId}/consent":{"post":{"tags":["cati"],"summary":"The person agreed on the call: start recording now (campaigns that record calls)","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiEntriesEntryIdCallCallIdConsent","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"callId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiVoiceCall"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/call/{callId}/hang-up":{"post":{"tags":["cati"],"summary":"End the call","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiEntriesEntryIdCallCallIdHangUp","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"callId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiVoiceCall"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/voice/status":{"get":{"tags":["cati"],"summary":"Can calls through Sayvara work for you now: ready, or the reason they cannot (not_configured: voice is not switched on for this organisation; not_entitled: the plan has no phone calls)","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiVoiceStatus","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiVoiceStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/voice/softphone-token":{"post":{"tags":["cati"],"summary":"Your own 15-minute softphone token for taking calls in the browser (incoming only, never cached). 409 CATI_VOICE_NOT_CONFIGURED until voice is on; 409 CATI_VOICE_NO_SOFTPHONE when you answer on a phone number; 403 CATI_VOICE_NOT_ENTITLED without the phone-calls plan feature; 403 FORBIDDEN for a role without cati.call or an unknown membership","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiVoiceSoftphoneToken","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiSoftphoneToken"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/interview":{"post":{"tags":["cati"],"summary":"Start the survey interview with the person you hold now: the interview id and the first question to read","description":"Permission: `cati.call`.","operationId":"postV1TenantsTenantIdCatiEntriesEntryIdInterview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/interviews/{interviewId}/answer":{"post":{"tags":["cati"],"summary":"Key in the reply to the current question; the next question, or the same one again with the reason","description":"Permission: `cati.call`.","operationId":"postV1TenantsTenantIdCatiInterviewsInterviewIdAnswer","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"interviewId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"state":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"reply":{"type":"string","maxLength":5000}},"required":["state","reply"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/interviews/{interviewId}/resume":{"post":{"tags":["cati"],"summary":"Pick up the interview at the first open question: from the state sent, else the state kept on the server (any caller holding the person)","description":"Permission: `cati.call`.","operationId":"postV1TenantsTenantIdCatiInterviewsInterviewIdResume","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"interviewId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"state":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/interviews/{interviewId}/consent":{"post":{"tags":["cati"],"summary":"Store the person's answer on the call to the recording question (agreed or declined) and whether a recording may be shown","description":"Permission: `cati.call`.","operationId":"postV1TenantsTenantIdCatiInterviewsInterviewIdConsent","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"interviewId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"given":{"type":"boolean"}},"required":["given"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/history":{"get":{"tags":["cati"],"summary":"Earlier calls, interviews and WhatsApp hand-offs in this campaign of the person you hold now (only while you hold them)","description":"Permission: `cati.call`.","operationId":"getV1TenantsTenantIdCatiEntriesEntryIdHistory","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/interviews/{interviewId}/complete":{"post":{"tags":["cati"],"summary":"Store the finished interview as one phone (voice) answer of the person held, or screened out by a full quota","description":"Permission: `cati.call`.","operationId":"postV1TenantsTenantIdCatiInterviewsInterviewIdComplete","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"interviewId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"state":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["state"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/ai-interview":{"get":{"tags":["cati"],"summary":"The AI interview of the person you hold now: the guide, the question to read out and where the interview stands","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiEntriesEntryIdAiInterview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiAiInterview"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/ai-interview/replies":{"post":{"tags":["cati"],"summary":"Key in what the person said; it goes through the same checks as every interview reply (consent, follow-up questions, stop rules, masking) and the next question comes back","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiEntriesEntryIdAiInterviewReplies","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiAiInterviewStep"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":8000},"replyId":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9:._-]+$"}},"required":["text"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/board":{"get":{"tags":["cati"],"summary":"The live board of a campaign: call list counts, who is on which call and since when, calls today per caller, completed interviews with their quality check, and the assigned work by caller or team (a stale assignment counted in the shared queue). Reading it first closes (exhausted) the AI interview entries whose interview has ended","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiCampaignsCampaignIdBoard","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiBoard"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/interviews/{interviewId}/qc":{"put":{"tags":["cati"],"summary":"Score a completed interview (0 to 100) with an optional note; audited","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdCatiInterviewsInterviewIdQc","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"interviewId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiInterviewQc"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100},"note":{"type":"string","maxLength":1000}},"required":["score"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/callbacks":{"get":{"tags":["cati"],"summary":"Booked callbacks of a campaign: open and locked counts per caller, the callbacks soonest first and who each is booked with","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiCampaignsCampaignIdCallbacks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiCallbackAssignments"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/assignee":{"put":{"tags":["cati"],"summary":"Book one open callback with another caller on the campaign (not one being dialled or finished); audited","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdCatiEntriesEntryIdAssignee","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiEntryReassigned"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"toUserId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["toUserId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/callbacks/reassign":{"post":{"tags":["cati"],"summary":"Book every open callback of one caller with another caller on the campaign; callbacks being dialled stay; audited","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiCampaignsCampaignIdCallbacksReassign","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiCallerReassigned"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"fromUserId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"toUserId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["fromUserId","toUserId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/genesys-call":{"post":{"tags":["cati"],"summary":"Call the person you hold through Genesys: Genesys rings your agent, then the person. A repeat answers the same conversation; save the result with callId genesys:<conversationId>. The ticket in the answer is needed to follow the call. 404 CATI_GENESYS_OFF while calling with Genesys is not switched on for the organisation; 409 CATI_NOT_CLAIMED when someone else holds the person","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiEntriesEntryIdGenesysCall","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiGenesysCallStart"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"attemptKey":{"type":"string","pattern":"^[A-Za-z0-9._:-]{8,128}$"}},"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/genesys-call/{conversationId}":{"get":{"tags":["cati"],"summary":"Where the Genesys call is, its talk time and wrap-up (as a suggested call result you confirm), and the recording link only when the campaign records calls and the person agreed. Needs the ticket from the start: a call placed for another person, by another caller or in an earlier hold is 404. 404 CATI_GENESYS_OFF while calling with Genesys is not switched on for the organisation","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiEntriesEntryIdGenesysCallConversationId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"conversationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticket","in":"query","required":true,"schema":{"type":"string","maxLength":64}}],"x-sayvara-contract":{"response":"catiGenesysCallView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/call-now":{"post":{"tags":["cati"],"summary":"Call a number now: find or add the contact by the typed number and hold them on the campaign as a test call (marked demo_test in attrs); the call then goes on as for a queued person. 422 ORG_UNIT_REQUIRED for a new person when the caller is branch-scoped. 404 CATI_CALL_NOW_OFF while the organisation flag demo.repeat_tests is off; 400 unless agreed is true; 404 when the caller is not on the campaign (checked before the number is looked up); 409 CATI_CAMPAIGN_NOT_ACTIVE, 409 CATI_CALLER_PAUSED; 409 CATI_VOICE_OPTED_OUT when the person asked not to be called; 409 CATI_ENTRY_BUSY when another caller holds them, or when the caller holds a person of the call list (save or skip that call first); 409 CATI_NOT_CALLABLE for an AI interview or an entry of the call list (never taken as a test call); 503 CATI_SUPPRESSION_UNAVAILABLE when the do-not-call list cannot be read. A second call while the caller holds the person keeps the same claim and interview.","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiCampaignsCampaignIdCallNow","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiNext"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"phone":{"type":"string","minLength":1,"maxLength":40},"name":{"type":"string","minLength":1,"maxLength":120},"defaultCountry":{"default":"SA","type":"string","enum":["SA","AE","KW","BH","QA","OM"]},"orgUnitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agreed":{"type":"boolean","const":true}},"required":["phone","agreed"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/entries/{entryId}/call-again":{"post":{"tags":["cati"],"summary":"Call this test number again: hold the person of a test-call entry again with a fresh interview; 404 for an entry that is not a test call. 404 CATI_CALL_NOW_OFF while the organisation flag demo.repeat_tests is off; 400 unless agreed is true; 404 when the caller is not on the campaign (checked before the number is looked up); 409 CATI_CAMPAIGN_NOT_ACTIVE, 409 CATI_CALLER_PAUSED; 409 CATI_VOICE_OPTED_OUT when the person asked not to be called; 409 CATI_ENTRY_BUSY when another caller holds them, or when the caller holds a person of the call list (save or skip that call first); 409 CATI_NOT_CALLABLE for an AI interview or an entry of the call list (never taken as a test call); 503 CATI_SUPPRESSION_UNAVAILABLE when the do-not-call list cannot be read. A second call while the caller holds the person keeps the same claim and interview.","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiEntriesEntryIdCallAgain","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiNext"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"agreed":{"type":"boolean","const":true}},"required":["agreed"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/entries/{entryId}/work-assignee":{"put":{"tags":["cati"],"summary":"Give one entry of the call list to a caller on the campaign or to a team, or clear it (not one being dialled or finished); audited","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdCatiCampaignsCampaignIdEntriesEntryIdWorkAssignee","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"catiWorkAssigneeInput","response":"catiWorkAssignee"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"userId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["userId"],"additionalProperties":false},{"type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["unitId"],"additionalProperties":false},{"type":"object","properties":{"clear":{"type":"boolean","const":true}},"required":["clear"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/entries/assign":{"post":{"tags":["cati"],"summary":"Give up to 1000 listed entries, or every open entry matching a filter (status, source, current assignee, or only work its assignee can no longer take), to a caller or a team, or clear them; finished entries and those being dialled are skipped and counted; at most 5000 change per call (more: true asks for another); audited","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCatiCampaignsCampaignIdEntriesAssign","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"catiBulkAssignInput","response":"catiBulkAssigned"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"entryIds":{"minItems":1,"maxItems":1000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"filter":{"type":"object","properties":{"status":{"type":"string","enum":["pending","scheduled","callback"]},"source":{"type":"string","minLength":1,"maxLength":32},"assignee":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["userId"],"additionalProperties":false},{"type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["unitId"],"additionalProperties":false}]},"stale":{"type":"boolean","const":true}},"additionalProperties":false},"to":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["userId"],"additionalProperties":false},{"type":"object","properties":{"unitId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["unitId"],"additionalProperties":false},{"type":"object","properties":{"clear":{"type":"boolean","const":true}},"required":["clear"],"additionalProperties":false}]}},"required":["to"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/campaigns/{campaignId}/mine":{"get":{"tags":["cati"],"summary":"The signed-in caller's share of the campaign: entries assigned to them and to their teams, and the next few (names only, never a phone number)","description":"Permission: `cati.call`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiCampaignsCampaignIdMine","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"campaignId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"catiMine"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/cati/contacts":{"get":{"tags":["cati"],"summary":"Find people to add to a call list: search by name, by the last 4 digits of the number, or by the whole number (either stored spelling; never a part of a number), newest first, inside the member's branches. Each number shows only its last four digits; no email. With campaignId, each person says whether they are already on that call list. 400 BAD_CURSOR for a cursor that is not valid. The whole number is searched only for a member who may see full numbers (feedback.read, no phone field mask, not a demo organisation); anyone else gets 403 CONTACTS_FULL_NUMBER_SEARCH for a term of more than 4 digits. Every phone search is audited (cati.contacts.phone_search, a keyed digest of the term, never its digits) and limited to 30 a minute and 1,000 a day per member (429 RATE_LIMITED).","description":"Permission: `cati.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCatiContacts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"catiContactsQuery","response":"catiContactSearch"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/quality/rubric":{"get":{"tags":["text-analytics"],"summary":"The call and chat quality rubric (Arabic and English criteria with weights)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsQualityRubric","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["text-analytics"],"summary":"Save the rubric (a new version; refused if it changed since it was read)","description":"Permission: `members.write`.","operationId":"putV1TenantsTenantIdTextAnalyticsQualityRubric","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"rubric":{"type":"object","properties":{"name":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"criteria":{"minItems":2,"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,39}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":80},"ar":{"type":"string","minLength":1,"maxLength":80}},"required":["en","ar"],"additionalProperties":false},"guidance":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":400},"ar":{"type":"string","minLength":1,"maxLength":400}},"required":["en","ar"],"additionalProperties":false},"weight":{"type":"integer","minimum":1,"maximum":10}},"required":["id","label","guidance","weight"],"additionalProperties":false}}},"required":["name","criteria"],"additionalProperties":false},"version":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["rubric","version"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/quality/calls/sync":{"post":{"tags":["text-analytics"],"summary":"Pull newly scored calls from Telyzer through the call-quality connector, resuming a partial sync (503 while no connector is set up); audited, also when it fails part-way","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdTextAnalyticsQualityCallsSync","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"since":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"limit":{"default":10000,"type":"integer","minimum":1,"maximum":10000}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/quality/sync-status":{"get":{"tags":["text-analytics"],"summary":"When an automatic sync of scored calls last finished for this organisation (null when none has run)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsQualitySyncStatus","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/quality/calls":{"get":{"tags":["text-analytics"],"summary":"Scored calls and chats, newest first, with the rating per criterion (no transcript or name), of one agent or rubric version if asked","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsQualityCalls","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"agentId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"rubricVersion","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":9007199254740991}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/quality/correlation":{"get":{"tags":["text-analytics"],"summary":"How call quality and the same customers' survey scores move together, with intervals; hidden below the minimum base","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsQualityCorrelation","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"windowDays","in":"query","required":false,"schema":{"default":7,"type":"integer","minimum":1,"maximum":30}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/quality/agents":{"get":{"tags":["text-analytics"],"summary":"Call and chat quality per agent and per week next to the same customers' survey figure (NPS, CSAT or CES); hidden below the minimum base","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsQualityAgents","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"metric","in":"query","required":false,"schema":{"default":"nps","type":"string","enum":["nps","csat","ces"]}},{"name":"windowDays","in":"query","required":false,"schema":{"default":7,"type":"integer","minimum":1,"maximum":30}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/coaching/cards/draft":{"post":{"tags":["text-analytics"],"summary":"Write coaching cards for a period (no overlap with another period): tips with evidence counts, small groups hidden, AI through the gateway","description":"Permission: `coaching.manage`.","operationId":"postV1TenantsTenantIdTextAnalyticsCoachingCardsDraft","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"from":{"type":"string","maxLength":40},"to":{"type":"string","maxLength":40},"minGroup":{"type":"integer","minimum":3,"maximum":100},"lang":{"default":"ar","type":"string","enum":["en","ar"]}},"required":["from","to"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/coaching/cards":{"get":{"tags":["text-analytics"],"summary":"Coaching cards (waiting for approval, approved, rejected)","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsCoachingCards","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["draft","approved","rejected"]}},{"name":"employeeId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/coaching/cards/mine":{"get":{"tags":["text-analytics"],"summary":"The signed-in employee's approved coaching cards","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsCoachingCardsMine","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/coaching/cards/{cardId}":{"get":{"tags":["text-analytics"],"summary":"One coaching card","description":"Permission: `members.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsCoachingCardsCardId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/coaching/cards/{cardId}/approve":{"post":{"tags":["text-analytics"],"summary":"Approve a card waiting for approval as read (updatedAt; never your own): the employee can see it","description":"Permission: `coaching.manage`.","operationId":"postV1TenantsTenantIdTextAnalyticsCoachingCardsCardIdApprove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"updatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["updatedAt"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/coaching/cards/{cardId}/reject":{"post":{"tags":["text-analytics"],"summary":"Reject a card waiting for approval as read (updatedAt; never your own): the employee never sees it","description":"Permission: `coaching.manage`.","operationId":"postV1TenantsTenantIdTextAnalyticsCoachingCardsCardIdReject","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cardId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"updatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["updatedAt"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/benchmark":{"get":{"tags":["text-analytics"],"summary":"The Arabic accuracy benchmark report: the newest published labelled run per dialect and task with its provenance and method, or the method alone","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsBenchmark","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/benchmark/runs":{"get":{"tags":["text-analytics"],"summary":"The organisation's labelled benchmark runs, newest first (provenance, state, published or why not)","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdTextAnalyticsBenchmarkRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["text-analytics"],"summary":"Start a labelled benchmark run with the set's provenance (source, labeller, date, dialects) and its minimum base (200 or more)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdTextAnalyticsBenchmarkRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string"},"version":{"type":"string"},"provenance":{"type":"object","properties":{"source":{"type":"string"},"labeller":{"type":"string"},"labelledOn":{"type":"string"},"annotatorsPerItem":{"type":"integer","minimum":2,"maximum":9007199254740991},"agreementKappa":{"type":"number","minimum":-1,"maximum":1},"dialects":{"type":"array","items":{"type":"string"}}},"required":["source","labeller","labelledOn","annotatorsPerItem","agreementKappa","dialects"]},"minN":{"type":"integer","minimum":200,"maximum":9007199254740991}},"required":["name","version","provenance"]}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/benchmark/runs/{runId}/items":{"post":{"tags":["text-analytics"],"summary":"Add up to 200 labelled items; each new one is classified through the AI gateway at once, and only the labels are kept","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdTextAnalyticsBenchmarkRunsRunIdItems","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"items":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"dialect":{"type":"string"},"task":{"type":"string"},"text":{"type":"string"},"expected":{"type":"string"}},"required":["id","dialect","task","text","expected"]}}},"required":["items"]}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/benchmark/runs/{runId}/finish":{"post":{"tags":["text-analytics"],"summary":"Score the run and record its results; figures below the minimum base are suppressed, and an incomplete run is never published","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdTextAnalyticsBenchmarkRunsRunIdFinish","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/public-page":{"get":{"tags":["gov"],"summary":"The public \"you said, we did\" page settings (on/off, address, title, blocks shown, star method), the defaults and the minimum group size","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovPublicPage","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gov"],"summary":"Create or change the public page settings (whole-organisation access; the first save needs slug and title; on/off is publish and unpublish). Star minimums never go under 30 answers or 3 visits on the public page","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdGovPublicPage","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"slug":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{1,46}[a-z0-9])$"},"title":{"type":"object","properties":{"en":{"type":"string","maxLength":400},"ar":{"type":"string","maxLength":400}},"additionalProperties":false},"show":{"type":"object","properties":{"index":{"type":"boolean"},"services":{"type":"boolean"},"improvements":{"type":"boolean"},"stars":{"type":"boolean"}},"additionalProperties":false},"starConfig":{"type":"object","properties":{"surveyWeight":{"type":"number","minimum":0,"maximum":1},"mysteryWeight":{"type":"number","minimum":0,"maximum":1},"minSurveyAnswers":{"type":"integer","minimum":5,"maximum":100000},"minVisits":{"type":"integer","minimum":3,"maximum":1000},"requireBoth":{"type":"boolean"},"windowMonths":{"type":"integer","minimum":1,"maximum":12}},"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/public-page/publish":{"post":{"tags":["gov"],"summary":"Turn the public page on (audited; needs a licence that is not read-only on-prem)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdGovPublicPagePublish","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/public-page/unpublish":{"post":{"tags":["gov"],"summary":"Turn the public page off (audited; after the page is turned off, an edge cache may serve the last copy for up to about 15 minutes)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdGovPublicPageUnpublish","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/public-page/refresh":{"post":{"tags":["gov"],"summary":"Build the public snapshot now: the latest index headline, service results and branch stars as whole percents, only for groups at or above the minimum size (30 answers, 3 visits); no personal data","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdGovPublicPageRefresh","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/public-page/improvements":{"get":{"tags":["gov"],"summary":"The \"you said, we did\" entries (unpublished and published)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovPublicPageImprovements","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["gov"],"summary":"Add a \"you said, we did\" entry (texts in English and/or Arabic, at most 300 (you said) and 1,000 (we did) characters; Arabic with vowel marks fits about half as many letters); unpublished unless published is true, which also needs tenant.update and is audited","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdGovPublicPageImprovements","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"youSaid":{"type":"object","properties":{"en":{"type":"string","maxLength":600},"ar":{"type":"string","maxLength":600}},"additionalProperties":false},"weDid":{"type":"object","properties":{"en":{"type":"string","maxLength":2000},"ar":{"type":"string","maxLength":2000}},"additionalProperties":false},"doneOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"published":{"type":"boolean"},"sort":{"type":"integer","minimum":0,"maximum":10000}},"required":["youSaid","weDid","doneOn"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/public-page/improvements/{id}":{"patch":{"tags":["gov"],"summary":"Change an unpublished entry; publishing, unpublishing or changing a published entry also needs tenant.update and is audited","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdGovPublicPageImprovementsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"youSaid":{"type":"object","properties":{"en":{"type":"string","maxLength":600},"ar":{"type":"string","maxLength":600}},"additionalProperties":false},"weDid":{"type":"object","properties":{"en":{"type":"string","maxLength":2000},"ar":{"type":"string","maxLength":2000}},"additionalProperties":false},"doneOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"published":{"type":"boolean"},"sort":{"type":"integer","minimum":0,"maximum":10000}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["gov"],"summary":"Delete an entry; a published one also needs tenant.update and is audited","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdGovPublicPageImprovementsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/stars":{"get":{"tags":["gov"],"summary":"Service-centre star board (GV-16): each active branch with 1-5 stars mixing survey satisfaction (the surveys mapped to services of its unit) and mystery-shopper scores, both parts with their bases, and the method in English and Arabic (for staff screens and the TV)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovStars","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/stars/wall":{"get":{"tags":["gov"],"summary":"TV star board (GV-16): the same board for a signed-in member or a paired TV display with the scores panel (403 DISPLAY_PANEL_NOT_ALLOWED without it); a whole-organisation caller sees every active branch, a scoped member or display only the branches in its units; no customer data","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdGovStarsWall","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/public/{slug}":{"get":{"tags":["gov"],"summary":"Public \"you said, we did\" page (no sign-in; 404 unless the tenant is active and the page is on under this address): satisfaction, service results and branch stars at or above the minimum group size, the published improvements, and the optional tenant brand (name; logo only as an inline PNG, JPEG or WebP or an https address on sayvara.com); cacheable for 5 minutes plus revalidation (after the page is turned off, an edge cache may serve the last copy for up to about 15 minutes), ETag, rate limited, no personal data","operationId":"getV1TenantsTenantIdGovPublicSlug","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"slug","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/public/{slug}/sites/{siteCode}":{"get":{"tags":["gov"],"summary":"One branch's stars for its QR code, with the optional tenant brand (no sign-in; 404 unless the page is on, stars are shown and the branch has enough data); cacheable (after the page is turned off, an edge cache may serve the last copy for up to about 15 minutes), rate limited","operationId":"getV1TenantsTenantIdGovPublicSlugSitesSiteCode","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"slug","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"siteCode","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/connectors":{"get":{"tags":["gov"],"summary":"Government complaints and service-rating sources: each with its display name in English and Arabic, import from an exported file, and the live API status (not offered)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovConnectors","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/connectors/{source}/import":{"post":{"tags":["gov"],"summary":"Import an exported CSV (comma or semicolon) or JSON file (up to 95,000 characters per call) with a column mapping (suggested when omitted; the free-text subject is never suggested because it can hold names, and is masked when mapped): dedupe by external reference; dryRun (default true) previews counts, issues, warnings (ambiguous d/m/y dates) and sample rows and stores nothing; otherwise stores and logs the import, first deleting expired cases only with the gov.ext_retention_enforce flag on for the tenant and a saved retention, unless an organisation-wide legal hold applies (audited)","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdGovConnectorsSourceImport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"format":{"type":"string","enum":["csv","json"]},"content":{"type":"string","minLength":1,"maxLength":95000},"fileName":{"type":"string","minLength":1,"maxLength":200},"mapping":{"type":"object","properties":{"externalRef":{"type":"string","minLength":1,"maxLength":100},"receivedAt":{"type":"string","minLength":1,"maxLength":100},"kind":{"type":"string","minLength":1,"maxLength":100},"status":{"type":"string","minLength":1,"maxLength":100},"closedAt":{"type":"string","minLength":1,"maxLength":100},"serviceCode":{"type":"string","minLength":1,"maxLength":100},"siteCode":{"type":"string","minLength":1,"maxLength":100},"category":{"type":"string","minLength":1,"maxLength":100},"rating":{"type":"string","minLength":1,"maxLength":100},"subject":{"type":"string","minLength":1,"maxLength":100}},"additionalProperties":false},"dryRun":{"default":true,"type":"boolean"}},"required":["format","content"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/connectors/imports":{"get":{"tags":["gov"],"summary":"The import log: source, file name, mapping, counts, who and when","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovConnectorsImports","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/connectors/cases":{"get":{"tags":["gov"],"summary":"Imported complaints and ratings inside the retention window, newest first, cursor paging (whole-organisation access)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovConnectorsCases","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["tawasul","service_rating"]}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["complaint","rating"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/connectors/summary":{"get":{"tags":["gov"],"summary":"Summary of the imported cases inside the retention window (whole-organisation access): counts by source, type and status, received and closed per month for the last 12 months (Riyadh time), the median time to close, and the mean rating per service code and per branch code; groups with fewer than 5 rated cases are not listed, only counted as hidden, and stay in every total","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovConnectorsSummary","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/gov/connectors/settings":{"get":{"tags":["gov"],"summary":"How long imported cases are kept (months; default 24; updatedAt null when none is saved, so nothing is counted or deleted), retentionHeld (an organisation-wide legal hold stops every deletion) and retentionEnforced (the gov.ext_retention_enforce flag on for the tenant and no such hold; a failed flag read is false)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdGovConnectorsSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["gov"],"summary":"Change how long imported cases are kept (1-120 months); cases outside the window are deleted now (audited) only with deleteExpired true, the gov.ext_retention_enforce flag on for the tenant and no organisation-wide legal hold; otherwise nothing is deleted","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdGovConnectorsSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"retentionMonths":{"type":"integer","minimum":1,"maximum":120},"deleteExpired":{"type":"boolean"}},"required":["retentionMonths"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/survey-ai/follow-up":{"post":{"tags":["text-analytics"],"summary":"SV-02 preview: whether an answer gets one follow-up question, worded in the respondent's dialect (AI through the gateway, else a template)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsSurveyAiFollowUp","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"followUpRequestSchema","response":"FollowUpResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts followUpRequestSchema"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/survey-ai/draft":{"post":{"tags":["text-analytics"],"summary":"SV-03: a bilingual machine suggestion of a survey from a brief or pasted page text","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsSurveyAiDraft","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"draftRequestSchema","response":"DraftResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts draftRequestSchema"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/survey-ai/translate":{"post":{"tags":["text-analytics"],"summary":"SV-05: machine suggestions of survey texts in another language with the tenant glossary applied, for review","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsSurveyAiTranslate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"translateRequestSchema","response":"TranslateResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts translateRequestSchema"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/survey-ai/translate/approve":{"post":{"tags":["text-analytics"],"summary":"SV-05: approve reviewed translations (audited), with glossary gaps as warnings","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsSurveyAiTranslateApprove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"approveRequestSchema"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts approveRequestSchema"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/survey-ai/shorten":{"get":{"tags":["text-analytics"],"summary":"SV-13: which questions add little and where respondents quit, with the questions to skip and the reasons","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsSurveyAiShorten","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"shortenQuerySchema","response":"ShortenReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/survey-ai/shorten/next":{"post":{"tags":["text-analytics"],"summary":"SV-13 preview: the remaining questions one respondent would skip (plan skips, plus fatigue skips above the minimum set)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsSurveyAiShortenNext","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"nextSkipsRequestSchema","response":"NextSkipsResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts nextSkipsRequestSchema"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panels":{"get":{"tags":["stats"],"summary":"Respondent panels of the organisation (organisation-wide members only)","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdStatsPanels","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Create a respondent panel with its consent wording and contact rules","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdStatsPanels","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"consentText":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":2000},"ar":{"type":"string","minLength":1,"maxLength":2000}},"required":["en","ar"],"additionalProperties":false},"rules":{"type":"object","properties":{"maxInvitesPer30Days":{"type":"integer","minimum":1,"maximum":10},"minDaysBetween":{"type":"integer","minimum":0,"maximum":90},"fatigueAfter":{"type":"integer","minimum":2,"maximum":10},"restDays":{"type":"integer","minimum":7,"maximum":365}},"additionalProperties":false}},"required":["name","consentText"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panels/{panelId}":{"get":{"tags":["stats"],"summary":"A panel with its member counts","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdStatsPanelsPanelId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["stats"],"summary":"Rename, close, re-word consent (raises the version) or change contact rules","description":"Permission: `contacts.write`.","operationId":"patchV1TenantsTenantIdStatsPanelsPanelId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"status":{"type":"string","enum":["active","closed"]},"consentText":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":2000},"ar":{"type":"string","minLength":1,"maxLength":2000}},"required":["en","ar"],"additionalProperties":false},"rules":{"type":"object","properties":{"maxInvitesPer30Days":{"type":"integer","minimum":1,"maximum":10},"minDaysBetween":{"type":"integer","minimum":0,"maximum":90},"fatigueAfter":{"type":"integer","minimum":2,"maximum":10},"restDays":{"type":"integer","minimum":7,"maximum":365}},"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panels/{panelId}/members":{"get":{"tags":["stats"],"summary":"Panel members, by id","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdStatsPanelsPanelIdMembers","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","left"]}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Add a contact who agreed to join, with their consent and profile","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdStatsPanelsPanelIdMembers","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"consent":{"type":"object","properties":{"version":{"type":"integer","minimum":1,"maximum":9007199254740991},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"source":{"type":"string","enum":["survey","form","phone","import"]},"adult":{"type":"boolean","const":true}},"required":["version","at","source","adult"],"additionalProperties":false},"profile":{"default":{},"type":"object","properties":{"country":{"type":"string","pattern":"^[A-Za-z]{2}$"},"region":{"type":"string","minLength":1,"maxLength":64},"city":{"type":"string","minLength":1,"maxLength":64},"ageBand":{"type":"string","enum":["18-24","25-34","35-44","45-54","55-64","65+"]},"gender":{"type":"string","enum":["female","male","prefer_not_to_say"]},"sector":{"type":"string","minLength":1,"maxLength":64},"language":{"type":"string","enum":["ar","en"]}},"additionalProperties":false},"lang":{"default":"ar","type":"string","enum":["ar","en"]}},"required":["contactId","consent"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panels/{panelId}/members/{memberId}":{"get":{"tags":["stats"],"summary":"A member with invites, response rate and whether they may be invited now","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdStatsPanelsPanelIdMembersMemberId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"memberId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["stats"],"summary":"Update a member profile or language, or record renewed consent","description":"Permission: `contacts.write`.","operationId":"patchV1TenantsTenantIdStatsPanelsPanelIdMembersMemberId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"memberId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"profile":{"type":"object","properties":{"country":{"type":"string","pattern":"^[A-Za-z]{2}$"},"region":{"type":"string","minLength":1,"maxLength":64},"city":{"type":"string","minLength":1,"maxLength":64},"ageBand":{"type":"string","enum":["18-24","25-34","35-44","45-54","55-64","65+"]},"gender":{"type":"string","enum":["female","male","prefer_not_to_say"]},"sector":{"type":"string","minLength":1,"maxLength":64},"language":{"type":"string","enum":["ar","en"]}},"additionalProperties":false},"lang":{"type":"string","enum":["ar","en"]},"consent":{"type":"object","properties":{"version":{"type":"integer","minimum":1,"maximum":9007199254740991},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"source":{"type":"string","enum":["survey","form","phone","import"]},"adult":{"type":"boolean","const":true}},"required":["version","at","source","adult"],"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panels/{panelId}/members/{memberId}/leave":{"post":{"tags":["stats"],"summary":"The member leaves the panel; their profile is cleared","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdStatsPanelsPanelIdMembersMemberIdLeave","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"memberId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"reason":{"type":"string","maxLength":500}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panels/{panelId}/samples":{"post":{"tags":["stats"],"summary":"Draw a sample with quotas from members who may be contacted now (or preview it)","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdStatsPanelsPanelIdSamples","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"target":{"type":"integer","minimum":1,"maximum":5000},"filters":{"default":{},"type":"object","properties":{"country":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"region":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"city":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"ageBand":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"gender":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"sector":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"language":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"additionalProperties":false},"quotas":{"default":[],"maxItems":3,"type":"array","items":{"type":"object","properties":{"field":{"type":"string","enum":["country","region","city","ageBand","gender","sector","language"]},"cells":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"value":{"type":"string","minLength":1,"maxLength":64},"target":{"type":"integer","minimum":0,"maximum":5000}},"required":["value","target"],"additionalProperties":false}}},"required":["field","cells"],"additionalProperties":false}},"incentive":{"type":"object","properties":{"kind":{"type":"string","enum":["points","voucher","donation","prize_draw"]},"amount":{"type":"number","minimum":0,"maximum":100000},"currency":{"type":"string","enum":["SAR","USD"]}},"required":["kind","amount"],"additionalProperties":false},"seed":{"type":"string","minLength":1,"maxLength":100},"preview":{"default":false,"type":"boolean"}},"required":["surveyId","target"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["stats"],"summary":"Samples drawn from the panel, newest first","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdStatsPanelsPanelIdSamples","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panels/{panelId}/samples/{sampleId}":{"get":{"tags":["stats"],"summary":"A sample with invite counts, outcomes and recorded incentives","description":"Permission: `contacts.write`.","operationId":"getV1TenantsTenantIdStatsPanelsPanelIdSamplesSampleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sampleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panels/{panelId}/samples/{sampleId}/invites":{"post":{"tags":["stats"],"summary":"Send the sample invites that have not been sent (each needs a survey link)","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdStatsPanelsPanelIdSamplesSampleIdInvites","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sampleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panels/{panelId}/outcomes":{"post":{"tags":["stats"],"summary":"Record whether an invited member answered, declined or did not answer","description":"Permission: `contacts.write`.","operationId":"postV1TenantsTenantIdStatsPanelsPanelIdOutcomes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"panelId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"inviteId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"outcome":{"type":"string","enum":["responded","declined","no_response"]},"at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["inviteId","outcome"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/concept-tests":{"get":{"tags":["stats"],"summary":"Concept tests","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsConceptTests","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Define a monadic or sequential monadic concept test on a survey","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdStatsConceptTests","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"design":{"type":"string","enum":["monadic","sequential_monadic"]},"concepts":{"minItems":2,"maxItems":12,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":200},"ar":{"type":"string","minLength":1,"maxLength":200}},"required":["en","ar"],"additionalProperties":false},"questions":{"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":64}}},"required":["id","label","questions"],"additionalProperties":false}},"metrics":{"minItems":1,"maxItems":8,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":200},"ar":{"type":"string","minLength":1,"maxLength":200}},"required":["en","ar"],"additionalProperties":false},"kind":{"type":"string","enum":["top_box","mean"]},"scaleMin":{"type":"number"},"scaleMax":{"type":"number"},"topBox":{"type":"number"}},"required":["key","label","kind","scaleMin","scaleMax"],"additionalProperties":false}}},"required":["name","surveyId","design","concepts","metrics"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/concept-tests/{testId}":{"get":{"tags":["stats"],"summary":"A concept test definition","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsConceptTestsTestId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"testId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["stats"],"summary":"Remove a concept test definition","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdStatsConceptTestsTestId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"testId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/concept-tests/{testId}/order":{"get":{"tags":["stats"],"summary":"The random concept order of one respondent","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsConceptTestsTestIdOrder","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"testId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"respondent","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":100}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/concept-tests/{testId}/results":{"get":{"tags":["stats"],"summary":"Concept test results: intervals, corrected comparisons, small bases hidden","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsConceptTestsTestIdResults","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"testId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/brand-trackers":{"get":{"tags":["stats"],"summary":"Brand-health trackers","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsBrandTrackers","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Define a brand tracker: brands, funnel questions and waves","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdStatsBrandTrackers","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"brands":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":200},"ar":{"type":"string","minLength":1,"maxLength":200}},"required":["en","ar"],"additionalProperties":false}},"required":["id","label"],"additionalProperties":false}},"questions":{"type":"object","properties":{"awareness":{"type":"string","minLength":1,"maxLength":64},"consideration":{"type":"string","minLength":1,"maxLength":64},"preference":{"type":"string","minLength":1,"maxLength":64}},"required":["awareness"],"additionalProperties":false},"optionBrands":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":64},"additionalProperties":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"}},"waves":{"default":[],"maxItems":52,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":200},"ar":{"type":"string","minLength":1,"maxLength":200}},"required":["en","ar"],"additionalProperties":false},"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","label","from","to"],"additionalProperties":false}}},"required":["name","surveyId","brands","questions"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/brand-trackers/{trackerId}":{"get":{"tags":["stats"],"summary":"A brand tracker definition","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsBrandTrackersTrackerId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"trackerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["stats"],"summary":"Remove a brand tracker definition","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdStatsBrandTrackersTrackerId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"trackerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/brand-trackers/{trackerId}/waves":{"put":{"tags":["stats"],"summary":"Replace the tracker waves","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdStatsBrandTrackersTrackerIdWaves","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"trackerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"waves":{"maxItems":52,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,31}$"},"label":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":200},"ar":{"type":"string","minLength":1,"maxLength":200}},"required":["en","ar"],"additionalProperties":false},"from":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"to":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","label","from","to"],"additionalProperties":false}}},"required":["waves"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/brand-trackers/{trackerId}/results":{"get":{"tags":["stats"],"summary":"Funnel per wave and trends with significance between waves","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsBrandTrackersTrackerIdResults","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"trackerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panel-sourcing":{"get":{"tags":["stats"],"summary":"Respondent sourcing: whether it is on, whether a panel partner is connected, and the requests","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdStatsPanelSourcing","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsSourcingList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panel-sourcing/quotes":{"post":{"tags":["stats"],"summary":"Ask the panel partner for a quote (Idempotency-Key header; price excludes VAT)","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdStatsPanelSourcingQuotes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsSourcingRequest"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"targetCompletes":{"type":"integer","minimum":10,"maximum":5000},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"criteria":{"default":{},"type":"object","properties":{"ageBands":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","enum":["18-24","25-34","35-44","45-54","55-64","65+"]}},"genders":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","enum":["female","male","prefer_not_to_say"]}},"languages":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","enum":["ar","en"]}},"regions":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"sectors":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}}},"additionalProperties":false},"incidencePct":{"type":"number","minimum":1,"maximum":100},"lengthMinutes":{"type":"integer","minimum":1,"maximum":60},"maxPricePerCompleteHalalas":{"type":"integer","minimum":1,"maximum":10000000}},"required":["surveyId","targetCompletes","country","incidencePct","lengthMinutes","maxPricePerCompleteHalalas"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panel-sourcing/{requestId}":{"get":{"tags":["stats"],"summary":"A sourcing request with its quote, counts and billable amount","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdStatsPanelSourcingRequestId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsSourcingRequest"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panel-sourcing/{requestId}/launch":{"post":{"tags":["stats"],"summary":"Launch a quoted request with the partner (Idempotency-Key header)","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdStatsPanelSourcingRequestIdLaunch","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsSourcingRequest"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panel-sourcing/{requestId}/refresh":{"post":{"tags":["stats"],"summary":"Read the partner's counts and state","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdStatsPanelSourcingRequestIdRefresh","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsSourcingRequest"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panel-sourcing/{requestId}/reconcile":{"post":{"tags":["stats"],"summary":"Reconcile a closed request: accepted completes and the amount to bill","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdStatsPanelSourcingRequestIdReconcile","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsSourcingRequest"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panel-sourcing/{requestId}/cancel":{"post":{"tags":["stats"],"summary":"Cancel a request; a launched one is stopped with the partner and closed, so it is still reconciled","description":"Permission: `billing.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdStatsPanelSourcingRequestIdCancel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsSourcingRequest"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/panel-sourcing-callback":{"get":{"tags":["stats"],"summary":"The panel partner's signed redirect for one respondent","operationId":"getV1TenantsTenantIdStatsPanelSourcingCallback","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"The panel partner's signed postback for one respondent","operationId":"postV1TenantsTenantIdStatsPanelSourcingCallback","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/interviews/guides":{"get":{"tags":["text-analytics"],"summary":"AI interview guides: research goal, opening question, turn and time limits","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsInterviewsGuides","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","all"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["text-analytics"],"summary":"Write an AI interview guide (the opening question must pass the same checks as AI questions)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsInterviewsGuides","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["en","ar"],"additionalProperties":false},"objective":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":500},"ar":{"type":"string","minLength":1,"maxLength":500}},"required":["en","ar"],"additionalProperties":false},"opening":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":240},"ar":{"type":"string","minLength":1,"maxLength":240}},"required":["en","ar"],"additionalProperties":false},"maxTurns":{"default":4,"type":"integer","minimum":1,"maximum":8},"maxMinutes":{"default":5,"type":"integer","minimum":1,"maximum":15}},"required":["name","objective","opening"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/interviews/guides/{guideId}":{"patch":{"tags":["text-analytics"],"summary":"Change or archive an AI interview guide","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdTextAnalyticsInterviewsGuidesGuideId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"guideId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"guide":{"type":"object","properties":{"name":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":120},"ar":{"type":"string","minLength":1,"maxLength":120}},"required":["en","ar"],"additionalProperties":false},"objective":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":500},"ar":{"type":"string","minLength":1,"maxLength":500}},"required":["en","ar"],"additionalProperties":false},"opening":{"type":"object","properties":{"en":{"type":"string","minLength":1,"maxLength":240},"ar":{"type":"string","minLength":1,"maxLength":240}},"required":["en","ar"],"additionalProperties":false},"maxTurns":{"default":4,"type":"integer","minimum":1,"maximum":8},"maxMinutes":{"default":5,"type":"integer","minimum":1,"maximum":15}},"required":["name","objective","opening"],"additionalProperties":false},"archived":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/interviews/guides/{guideId}/themes":{"get":{"tags":["text-analytics"],"summary":"Themes in the answers of a guide's ended interviews, grouped automatically without a model: masked answers only, counted per interview, up to 3 example answers each; none below the minimum number of interviews (enough false)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsInterviewsGuidesGuideIdThemes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"guideId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taInterviewThemes"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/interviews/channels":{"get":{"tags":["text-analytics"],"summary":"Channels a start may use besides manual: WhatsApp when the organisation has WhatsApp interviews switched on and its CL-14 agent on; aiPhone when the AI interviewer may call (switch interviews.phone on, a voice call port bound, the member holds cati.manage)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsInterviewsChannels","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"taInterviewChannels"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/interviews":{"get":{"tags":["text-analytics"],"summary":"AI interviews, newest first, without transcripts","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsInterviews","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"guideId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["awaiting_consent","active","completed","declined","stopped"]}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["text-analytics"],"summary":"Start an AI interview: the consent question goes first. Channel manual (staff key in the replies), whatsapp (inside the 24-hour window, the organisation switch on) or phone: campaignId names the CATI campaign whose callers run it and the person goes on its call list, or voice ai lets the AI interviewer call the person itself (organisation switch interviews.phone, else 409 INTERVIEW_CHANNEL_OFF); one of the two is required on phone and refused elsewhere, and the member also needs cati.manage (403 FORBIDDEN)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsInterviews","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"guideId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"contactId":{"default":null,"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"responseId":{"default":null,"anyOf":[{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9:._-]+$"},{"type":"null"}]},"channel":{"default":"manual","type":"string","enum":["manual","whatsapp","phone","survey_page"]},"lang":{"default":"ar","type":"string","enum":["ar","en"]},"campaignId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"voice":{"type":"string","const":"ai"}},"required":["guideId"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/interviews/{interviewId}":{"get":{"tags":["text-analytics"],"summary":"One AI interview with its consent and masked transcript","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsInterviewsInterviewId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"interviewId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/interviews/{interviewId}/replies":{"post":{"tags":["text-analytics"],"summary":"Record a respondent reply and get the next checked question, a fixed fallback question, or the closing line; a phone interview answers 409 INTERVIEW_PHONE_VIA_DESK (its replies come through the caller desk)","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsInterviewsInterviewIdReplies","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"interviewId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":8000},"replyId":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-z0-9:._-]+$"}},"required":["text"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/interviews/{interviewId}/stop":{"post":{"tags":["text-analytics"],"summary":"End an AI interview; optionally blank every answer. The call-list entry of a phone interview closes with it, and an AI phone call still live is hung up","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdTextAnalyticsInterviewsInterviewIdStop","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"interviewId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"erase":{"default":false,"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/visibility/setup":{"get":{"tags":["text-analytics"],"summary":"The AI visibility setup: brand names (EN/AR), own domains, services and tracking questions (whole organisation only)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsVisibilitySetup","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["text-analytics"],"summary":"Save the AI visibility setup (a new version; refused if it changed since it was read, or a question holds personal data or names a person); audited","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdTextAnalyticsVisibilitySetup","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"setup":{"type":"object","properties":{"brandNames":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":80}},"ownDomains":{"default":[],"maxItems":10,"type":"array","items":{"type":"string","maxLength":253,"pattern":"^(?!-)(?:[a-z0-9-]{1,63}\\.)+[a-z]{2,63}$"}},"services":{"default":[],"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]{0,39}$"},"names":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":80}}},"required":["id","names"],"additionalProperties":false}},"questions":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]{0,39}$"},"lang":{"type":"string","enum":["ar","en"]},"text":{"type":"string","minLength":5,"maxLength":300}},"required":["id","lang","text"],"additionalProperties":false}}},"required":["brandNames","questions"],"additionalProperties":false},"version":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["setup","version"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/visibility/engines":{"get":{"tags":["text-analytics"],"summary":"AI assistants and AI search engines that can be asked (none while no connector is set up)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsVisibilityEngines","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/visibility/checks/run":{"post":{"tags":["text-analytics"],"summary":"Ask the engines the tracking questions once and store the analysis of each answer, never its text. Cloud AI, AI licence and plan required; one run per hour; at most 100 questions x engines; audited (503 while no connector is set up)","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdTextAnalyticsVisibilityChecksRun","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"questionIds":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]{0,39}$"}},"engines":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,31}$"}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/visibility/checks":{"get":{"tags":["text-analytics"],"summary":"Stored answer analyses, newest first: brand named, tone, services, cited hosts","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsVisibilityChecks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"engine","in":"query","required":false,"schema":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,31}$"}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/visibility/report":{"get":{"tags":["text-analytics"],"summary":"How AI answers describe the brand and services per engine and language on the current setup version, next to customer feedback; hidden below the minimum base","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsVisibilityReport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/watches":{"get":{"tags":["text-analytics"],"summary":"The member's own watched questions: title, rule, threshold, cadence, last check and state","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTextAnalyticsWatches","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"TaWatchDto[]"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["text-analytics"],"summary":"Watch an Ask answer: checked daily or weekly, with an alert when the rule is met. Personal data in the title is masked; refused above the per-member limit; audited","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTextAnalyticsWatches","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"TaWatchCreateDto","response":"TaWatchDto"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts TaWatchCreateDto"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/watches/{watchId}":{"patch":{"tags":["text-analytics"],"summary":"Change a watched question's rule, threshold, cadence or pause it (own watches only); audited","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdTextAnalyticsWatchesWatchId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"watchId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"TaWatchPatchDto","response":"TaWatchDto"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts TaWatchPatchDto"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["text-analytics"],"summary":"Stop watching a question (own watches only); audited","description":"Permission: `dashboards.read`.","operationId":"deleteV1TenantsTenantIdTextAnalyticsWatchesWatchId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"watchId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/mentions-catalogue":{"get":{"tags":["text-analytics"],"summary":"The mentions catalogue: products, branches, services, brands and other things with English and Arabic names and aliases, and which names the matcher will not use (too short, generic, or shared)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdTextAnalyticsMentionsCatalogue","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["text-analytics"],"summary":"Add a catalogue entry (at most 300; 20 aliases per language; no personal data; a branch entry may point at an org unit you can see); audited; 60 edits a minute per person (429 RATE_LIMITED)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdTextAnalyticsMentionsCatalogue","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"kind":{"type":"string","enum":["product","branch","service","brand","other"]},"nameEn":{"type":"string"},"nameAr":{"type":"string"},"aliasesEn":{"default":[],"maxItems":40,"type":"array","items":{"type":"string"}},"aliasesAr":{"default":[],"maxItems":40,"type":"array","items":{"type":"string"}},"orgUnitId":{"default":null,"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"active":{"default":true,"type":"boolean"}},"required":["kind"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/text-analytics/mentions-catalogue/{id}":{"put":{"tags":["text-analytics"],"summary":"Replace a catalogue entry; audited; 60 edits a minute per person (429 RATE_LIMITED)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdTextAnalyticsMentionsCatalogueId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"kind":{"type":"string","enum":["product","branch","service","brand","other"]},"nameEn":{"type":"string"},"nameAr":{"type":"string"},"aliasesEn":{"default":[],"maxItems":40,"type":"array","items":{"type":"string"}},"aliasesAr":{"default":[],"maxItems":40,"type":"array","items":{"type":"string"}},"orgUnitId":{"default":null,"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"active":{"default":true,"type":"boolean"}},"required":["kind"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["text-analytics"],"summary":"Delete a catalogue entry; audited; 60 edits a minute per person (429 RATE_LIMITED)","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdTextAnalyticsMentionsCatalogueId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/send-time/summary":{"get":{"tags":["stats"],"summary":"Answer rate per channel and the answer-hour curve learnt across the organisation, with the segments","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdStatsSendTimeSummary","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsSendSummary"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/send-time/contacts/{contactId}":{"get":{"tags":["stats"],"summary":"Best consented channel and send hour for one contact (never inside quiet hours, nothing after an opt-out), with what was learnt (organisation-wide callers)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdStatsSendTimeContactsContactId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"at","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}}],"x-sayvara-contract":{"response":"statsSendContact"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/send-time/learn":{"post":{"tags":["stats"],"summary":"Re-learn every contact's channel and hour habits from past invitations (organisation-wide managers; 503 until the invitation history source is ready)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdStatsSendTimeLearn","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsSendLearnResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"days":{"default":180,"type":"integer","minimum":7,"maximum":365},"timeZone":{"default":"Asia/Riyadh","type":"string","minLength":1,"maxLength":64}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/ux/events":{"post":{"tags":["stats"],"summary":"Anonymous step events of one survey visit (proven by its signed link token) or one portal page visit (fixed steps of a page the tenant has in use); unknown steps, pages, tenants and tokens are dropped (202, accepted 0); adds to daily counters only","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdStatsUxEvents","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"uxAnyEventBatch"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts uxAnyEventBatch"}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/ux/funnel":{"get":{"tags":["stats"],"summary":"Funnel of one survey or one portal page (surface) per UTC day range: views, completion, drop-off and time on task per step (organisation-wide readers)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsUxFunnel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surface","in":"query","required":false,"schema":{"default":"survey","type":"string","enum":["survey","portal"]}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"page","in":"query","required":false,"schema":{"type":"string","enum":["public_page","case_status"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/revenue/comments":{"get":{"tags":["stats"],"summary":"Comments with their account's value and segment, ranked by the revenue they put at risk (503 until account values are available)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdStatsRevenueComments","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"segment","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","pattern":"^[A-Z]{3}$"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/revenue/segments":{"get":{"tags":["stats"],"summary":"Account value and value at risk per segment from the newest feedback of each account (503 until account values are available)","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdStatsRevenueSegments","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"segment","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"currency","in":"query","required":false,"schema":{"type":"string","pattern":"^[A-Z]{3}$"}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/kpis":{"get":{"tags":["stats"],"summary":"The organisation KPIs (key, names in English and Arabic, definition, format, direction, minimum base, \"i\" explainer, goal metric m:<key>) and the most one organisation may keep","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdStatsKpis","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsKpiList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["stats"],"summary":"Create a KPI at version 1 from a ready shape (score, average of a Number question, share under or over a limit, yes-rate of a yes/no question, formula over other KPIs, count of answers, top or bottom box of a scale question, share of chosen options, sentiment share; optional filters by surveys, channels and org units); organisation-wide managers only (403 STATS_KPI_SCOPE); audited as stats.kpi.created; 409 STATS_KPI_KEY_TAKEN, 409 STATS_KPI_LIMIT, 400 STATS_KPI_RESERVED_KEY, 400 STATS_KPI_BAD_DEFINITION, 400 STATS_KPI_BAD_FORMULA (with the positioned formula error), 400 VALIDATION_FAILED","description":"Permission: `goals.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdStatsKpis","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"statsKpiCreate","response":"statsKpi"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts statsKpiCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/kpis/{key}":{"get":{"tags":["stats"],"summary":"One KPI (404 NOT_FOUND)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdStatsKpisKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"statsKpi"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["stats"],"summary":"Change a KPI; the version goes up by one when the figure changes (definition, format, direction, minimum base); organisation-wide managers only (403 STATS_KPI_SCOPE); audited as stats.kpi.changed; 404 NOT_FOUND, 400 STATS_KPI_BAD_DEFINITION, 400 STATS_KPI_BAD_FORMULA, 400 VALIDATION_FAILED","description":"Permission: `goals.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdStatsKpisKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"statsKpiUpdate","response":"statsKpi"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts statsKpiUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["stats"],"summary":"Delete a KPI and its goals; organisation-wide managers only (403 STATS_KPI_SCOPE); audited as stats.kpi.deleted; 404 NOT_FOUND, 409 STATS_KPI_IN_USE (details.usedBy) while another KPI formula uses it","description":"Permission: `goals.manage`.","operationId":"deleteV1TenantsTenantIdStatsKpisKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/kpis/{key}/series":{"get":{"tags":["stats"],"summary":"The KPI by week or month (default the last 12 weeks) in the caller own scope: value, base, small-base flag, red / amber / green status against the unit or organisation goal, gap and explainer; 404 NOT_FOUND, 403 STATS_KPI_SCOPE for a unit outside the caller scope, 400 STATS_KPI_BAD_PERIOD for a reversed range or too many periods, 422 STATS_TOO_MANY_ANSWERS above 20,000 answers (never a partial series)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdStatsKpisKeySeries","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"statsKpiSeriesQuery","response":"statsKpiSeries"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/stats/kpis/{key}/export":{"get":{"tags":["stats"],"summary":"Download or print one KPI series in English or Arabic with its \"How we calculate\" appendix: html (print page, save as PDF), pptx, xlsx or docx; json is the access check before the print page (not counted, not audited). The other query fields are the series query (contract statsKpiSeriesQuery). Also needs dashboards.read (403 FORBIDDEN); counts against the export rate limits; audited as stats.kpi.exported; 404 NOT_FOUND, 403 STATS_KPI_SCOPE for a unit outside the caller scope, 400 STATS_KPI_BAD_PERIOD for a reversed range or too many periods, 422 STATS_TOO_MANY_ANSWERS above 20,000 answers (never a partial series)","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdStatsKpisKeyExport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["html","pptx","xlsx","docx","json"]}},{"name":"lang","in":"query","required":false,"schema":{"default":"en","type":"string","enum":["en","ar"]}}],"x-sayvara-contract":{"query":"statsKpiSeriesQuery"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews":{"get":{"tags":["reviews"],"summary":"Public reviews (Google Business Profile, App Store, Google Play; Facebook Page, Instagram and X only while their own switch reviews.meta_direct / reviews.x_direct is on, with rating null as they have no stars; and OmniBrand Google reviews read only: via omnibrand, sourceId the nil uuid, no reply state filter), newest first; filters by provider, source (and one review by sourceId + externalId), rating, language, branch, reply state and date; keyset pages (nextCursor)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdReviews","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"provider","in":"query","required":false,"schema":{"type":"string","enum":["google_business","app_store","google_play","facebook_page","instagram","x"]}},{"name":"sourceId","in":"query","required":false,"schema":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string","maxLength":300}},{"name":"ratingMin","in":"query","required":false,"schema":{"type":"string","pattern":"^[1-5]$"}},{"name":"ratingMax","in":"query","required":false,"schema":{"type":"string","pattern":"^[1-5]$"}},{"name":"lang","in":"query","required":false,"schema":{"type":"string","enum":["ar","en","other"]}},{"name":"branchId","in":"query","required":false,"schema":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}},{"name":"replyState","in":"query","required":false,"schema":{"type":"string","enum":["none","draft","replied"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":600}},{"name":"limit","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d{1,3}$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/sources":{"get":{"tags":["reviews"],"summary":"Review sources with their branch, on/off state, last sync, last error code and whether older reviews are all read","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdReviewsSources","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/sources/{sourceId}/sync":{"post":{"tags":["reviews"],"summary":"Read new reviews of one source now (404 SOURCE_NOT_FOUND, 409 SOURCE_DISABLED / SYNC_RUNNING, 503 PROVIDER_NOT_CONNECTED, 502 SYNC_FAILED); audited","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdReviewsSourcesSourceIdSync","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sourceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/settings":{"get":{"tags":["reviews"],"summary":"Reply settings (MF-04): replies on or off, tone, banned words, sign-off; off when never set","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdReviewsSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["reviews"],"summary":"Change the reply settings (owners and admins who see the whole organisation; never the demo guest); audited","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdReviewsSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"repliesEnabled":{"type":"boolean"},"replyTone":{"type":"string","enum":["warm","formal","brief"]},"bannedWords":{"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":60}},"signOff":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]}},"required":["repliesEnabled","replyTone","bannedWords","signOff"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/{sourceId}/{externalId}/reply-drafts":{"get":{"tags":["reviews"],"summary":"Reply drafts of one review: the open (or newest) draft and the history, newest first; error codes only","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdReviewsSourceIdExternalIdReplyDrafts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sourceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"externalId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["reviews"],"summary":"An AI reply draft through the AI gateway (masked text); never sent. 409 REPLIES_OFF / DRAFT_OPEN / REVIEW_REPLY_NOT_SUPPORTED (a Facebook Page, Instagram or X review is read only), 503 AI_NOT_CONFIGURED, 422 REPLY_RULES, 429 TOO_MANY_DRAFTS, 502 AI_FAILED; retryOf redrafts a reply that failed to post","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdReviewsSourceIdExternalIdReplyDrafts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sourceId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"externalId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"retryOf":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/reply-drafts/{id}":{"patch":{"tags":["reviews"],"summary":"Check an edited draft text (with the sign-off) against the reply rules (422 REPLY_RULES with the violation codes; 409 REVIEW_REPLY_NOT_SUPPORTED for a Facebook Page, Instagram or X review); the send call applies it; not the demo guest","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdReviewsReplyDraftsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"body":{"type":"string","maxLength":6000}},"required":["body"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/reply-drafts/{id}/send":{"post":{"tags":["reviews"],"summary":"Approve (as written or edited) and post the reply, one person's action; confirm: true required (400 CONFIRM_REQUIRED); body is the exact confirmed text, posted byte for byte (409 TEXT_CHANGED / BODY_NOT_EDITABLE); 503 PROVIDER_NOT_CONNECTED, 200 outcome posted or posted_unrecorded (live, not saved), 502 POST_FAILED (code only), 500 POST_UNCERTAIN, 422 REPLY_RULES, 409 REVIEW_REPLY_NOT_SUPPORTED (a Facebook Page, Instagram or X review is read only); every attempt audited","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdReviewsReplyDraftsIdSend","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"confirm":{"type":"boolean"},"body":{"type":"string","maxLength":6000}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/reply-drafts/{id}/reject":{"post":{"tags":["reviews"],"summary":"Discard an open reply draft; audited","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdReviewsReplyDraftsIdReject","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/ask-settings":{"get":{"tags":["reviews"],"summary":"Review-request settings (MF-03): available (template submitted and link secret set), askEnabled, askAll, askNpsMin, askCsatMin, askCapDays; tenant-wide members only (403 TENANT_WIDE_ONLY)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdReviewsAskSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["reviews"],"summary":"Change the review-request settings (any of the fields; unknown keys 400); 409 REVIEW_ASK_UNAVAILABLE when turning requests on before they can be sent; tenant-wide only, never the demo guest; audited","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdReviewsAskSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"askEnabled":{"type":"boolean"},"askAll":{"type":"boolean"},"askNpsMin":{"type":"integer","minimum":0,"maximum":10},"askCsatMin":{"type":"integer","minimum":1,"maximum":5},"askCapDays":{"type":"integer","minimum":1,"maximum":730}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/asks":{"get":{"tags":["reviews"],"summary":"Review requests: sent in the last 30 days, total, and the latest (when, review page, sent or waiting); no contact data; tenant-wide only","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdReviewsAsks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"default":10,"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/questionnaire/{surveyId}":{"get":{"tags":["surveys"],"summary":"One survey version (?version=N; default the newest) as a bilingual sign-off document: English and Arabic side by side, each question with its logic notes (required, display and skip rules, carry-forward, limits, random order, loops) and the quotas. application/pdf when the API has a print browser, else text/html for the browser's print dialog (X-Document-Format). 404 unknown or out of scope, 422 SURVEY_INVALID; audited","description":"Permission: `surveys.write`.","operationId":"getV1TenantsTenantIdReviewsQuestionnaireSurveyId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/survey-folders":{"get":{"tags":["survey-folders"],"summary":"Survey folders of the organisation with the caller's access (owner / edit / view), what the caller may do, and counts","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdReviewsSurveyFolders","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["survey-folders"],"summary":"A new folder owned by the caller (409 FOLDER_NAME_TAKEN for a name the caller already uses); audited","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdReviewsSurveyFolders","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/survey-folders/{folderId}":{"patch":{"tags":["survey-folders"],"summary":"Rename a folder (its owner, an admin or an edit share; 403 FOLDER_FORBIDDEN); audited","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdReviewsSurveyFoldersFolderId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"folderId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["survey-folders"],"summary":"Delete a folder and its shares; its surveys stay, in no folder (its owner or an admin); audited","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdReviewsSurveyFoldersFolderId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"folderId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/survey-folders/surveys":{"get":{"tags":["survey-folders"],"summary":"Per survey: folder, the caller's star, made by the caller, the strongest share reaching the caller, may share; view my / shared / all, folder (or none) and starred filters","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdReviewsSurveyFoldersSurveys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"view","in":"query","required":false,"schema":{"default":"all","type":"string","enum":["all","my","shared"]}},{"name":"folderId","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"string","const":"none"}]}},{"name":"favorites","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/survey-folders/surveys/{surveyId}/folder":{"put":{"tags":["survey-folders"],"summary":"File a survey into a folder, or take it out with folderId null (edit rights on both folders); audited","description":"Permission: `surveys.write`.","operationId":"putV1TenantsTenantIdReviewsSurveyFoldersSurveysSurveyIdFolder","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"folderId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["folderId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/survey-folders/surveys/{surveyId}/favorite":{"put":{"tags":["survey-folders"],"summary":"Star a survey (the caller's own list)","description":"Permission: `feedback.read`.","operationId":"putV1TenantsTenantIdReviewsSurveyFoldersSurveysSurveyIdFavorite","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["survey-folders"],"summary":"Remove the caller's star","description":"Permission: `feedback.read`.","operationId":"deleteV1TenantsTenantIdReviewsSurveyFoldersSurveysSurveyIdFavorite","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/survey-folders/share-targets":{"get":{"tags":["survey-folders"],"summary":"Active members (not the caller) and org units a survey or folder can be shared with; unit names follow Accept-Language","description":"Permission: `surveys.write`.","operationId":"getV1TenantsTenantIdReviewsSurveyFoldersShareTargets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/survey-folders/shares":{"get":{"tags":["survey-folders"],"summary":"Shares of one survey (surveyId) or folder (folderId); only for those who may manage them (403 SHARE_FORBIDDEN)","description":"Permission: `surveys.write`.","operationId":"getV1TenantsTenantIdReviewsSurveyFoldersShares","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"folderId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["survey-folders"],"summary":"Share a survey or folder with a member or an org unit (and everything under it), view or edit; sharing again changes the access; audited","description":"Permission: `surveys.write`.","operationId":"postV1TenantsTenantIdReviewsSurveyFoldersShares","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"survey"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kind","id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"folder"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kind","id"],"additionalProperties":false}]},"grantee":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"user"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kind","id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"unit"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kind","id"],"additionalProperties":false}]},"access":{"type":"string","enum":["view","edit"]}},"required":["target","grantee","access"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/survey-folders/shares/{shareId}":{"patch":{"tags":["survey-folders"],"summary":"Change a share's access; audited","description":"Permission: `surveys.write`.","operationId":"patchV1TenantsTenantIdReviewsSurveyFoldersSharesShareId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"shareId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"access":{"type":"string","enum":["view","edit"]}},"required":["access"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["survey-folders"],"summary":"Take a share away; audited","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdReviewsSurveyFoldersSharesShareId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"shareId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/participants":{"get":{"tags":["reports"],"summary":"Who answered one survey (surveyId, range d7|d30|d90): the funnel sent, delivered, opened, started, completed of personal invitations, answers without one, response and completion rates, by channel, org unit and segment; counts only, in the caller's org units; 404 when the survey is not this organisation's","description":"Permission: `dashboards.read`.","operationId":"getV1TenantsTenantIdReviewsParticipants","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"query","required":true,"schema":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}},{"name":"range","in":"query","required":false,"schema":{"default":"d30","type":"string","enum":["d7","d30","d90"]}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/integration-log/surveys/{surveyId}":{"get":{"tags":["integrations"],"summary":"The survey's syncs to and from the CRM and help desk, newest first: time, direction, external record, status and code; filters direction, system, status, from, to; keyset pages; members who see the whole organisation only (403 TENANT_WIDE_ONLY)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReviewsIntegrationLogSurveysSurveyId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"integrationLogQuery","response":"integrationLogList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/integration-log/entries/{entryId}/retry":{"post":{"tags":["integrations"],"summary":"Queue a failed outbound CRM case again; 409 NOT_RETRYABLE, CONNECTION_INACTIVE, SOURCE_GONE; audited; members who see the whole organisation only (403 TENANT_WIDE_ONLY)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdReviewsIntegrationLogEntriesEntryIdRetry","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"integrationLogRetry"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/report-schedules":{"get":{"tags":["reports"],"summary":"Report schedules with their report, cadence, calendar, formats, recipients, next three runs and last run; deliveryOn = scheduled delivery is on for the organisation; members who see the whole organisation only (403 TENANT_WIDE_ONLY)","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReviewsReportSchedules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"reportScheduleList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["reports"],"summary":"Schedule the board pack (monthly, PDF or PPTX) or a VoC report pack (daily to yearly, PDF, PPTX, XLSX or DOCX) by email; 400 REPORT_NOT_FOUND, RECIPIENTS_NOT_ALLOWED, CADENCE_INVALID, CADENCE_NOT_FOR_REPORT, FORMAT_NOT_FOR_REPORT; audited","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdReviewsReportSchedules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"reportScheduleCreate","response":"reportSchedule"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts reportScheduleCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/report-schedules/options":{"get":{"tags":["reports"],"summary":"What a schedule can send (board packs and VoC report packs; dashboards return with A8 phase 2), who can receive it (active, feedback.export, no field mask), and the number of branches; members who see the whole organisation only (403 TENANT_WIDE_ONLY)","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReviewsReportSchedulesOptions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"reportScheduleOptions"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/report-schedules/preview":{"post":{"tags":["reports"],"summary":"The next three runs of a cadence (Riyadh time, Gregorian or Hijri); 400 CADENCE_INVALID","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdReviewsReportSchedulesPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"reportSchedulePreview","response":"reportSchedulePreviewResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts reportSchedulePreview"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/report-schedules/{id}":{"patch":{"tags":["reports"],"summary":"Change, pause (enabled false) or resume a schedule; the next run is planned again; 400 as on create for what the patch changes; audited","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdReviewsReportSchedulesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"reportScheduleUpdate","response":"reportSchedule"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts reportScheduleUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["reports"],"summary":"Remove a schedule (retired: it stops and its delivery log stays); audited","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdReviewsReportSchedulesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/gbp-notifications":{"get":{"tags":["reviews"],"summary":"Google Business Profile review alerts: whether they are available and on, the connection, and the last run per account (outcomes and codes only); 404 while review sources are off","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdReviewsGbpNotifications","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/gbp-notifications/apply":{"post":{"tags":["reviews"],"summary":"Point every Business Profile account of the connection at Sayvara's Pub/Sub topic (NEW_REVIEW, UPDATED_REVIEW) again; idempotent, never overwrites another topic; 503 GBP_NOTIFY_UNAVAILABLE, 409 GBP_NOTIFY_OFF / CONNECTOR_NEEDS_CREDENTIALS / CONNECTOR_PAUSED; audited","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewsGbpNotificationsApply","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tickets":{"get":{"tags":["public-api"],"summary":"Follow-up tickets, oldest first, cursor paging (scope tickets.read; API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.tickets_reporting is off; rows limited to what the key's creator sees today; 403 API_KEY_CREATOR_FORBIDDEN when the creator no longer holds the scope's permissions in the app (tickets.read: feedback.read; tickets.write: feedback.read and tickets.write; reporting.read: dashboards.read)). Ids, codes, scores and times only","operationId":"getV1Tickets","security":[],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","in_progress","waiting","resolved","closed"]}},{"name":"from","in":"query","required":false,"schema":{"type":"string","maxLength":40,"pattern":"^\\d{4}-\\d{2}-\\d{2}T[0-9:.]+(Z|[+-]\\d{2}:\\d{2})$"}},{"name":"to","in":"query","required":false,"schema":{"type":"string","maxLength":40,"pattern":"^\\d{4}-\\d{2}-\\d{2}T[0-9:.]+(Z|[+-]\\d{2}:\\d{2})$"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}},{"name":"orgUnitId","in":"query","required":false,"schema":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":512}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tickets/{ticketId}":{"get":{"tags":["public-api"],"summary":"One ticket (scope tickets.read; API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.tickets_reporting is off; rows limited to what the key's creator sees today; 403 API_KEY_CREATOR_FORBIDDEN when the creator no longer holds the scope's permissions in the app (tickets.read: feedback.read; tickets.write: feedback.read and tickets.write; reporting.read: dashboards.read)); 404 when unknown or not visible","operationId":"getV1TicketsTicketId","security":[],"parameters":[{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["public-api"],"summary":"Change status, priority, root cause or closing codes, add a note, or assign a person (scope tickets.write, 60 a minute; API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.tickets_reporting is off; rows limited to what the key's creator sees today; 403 API_KEY_CREATOR_FORBIDDEN when the creator no longer holds the scope's permissions in the app (tickets.read: feedback.read; tickets.write: feedback.read and tickets.write; reporting.read: dashboards.read)). Optional Idempotency-Key (a repeat changes nothing) and If-Match (409 TICKET_CHANGED); the organisation's close rules apply (422 CLOSE_RULES_UNMET); a resolve or close asks the customer the follow-up question when that is on; every change is audited. assigneeId (the member id GET answers, or their user id; null unassigns) needs the switch api.tickets_assign (else 422 ASSIGN_NOT_ENABLED) and follows the app's rules: 422 ASSIGNEE_NOT_MEMBER (unknown or another organisation), ASSIGNEE_NOT_ACTIVE (suspended or disabled), ASSIGNEE_CANNOT_WORK_TICKETS, ASSIGNEE_OUT_OF_SCOPE (cannot see the branch)","operationId":"patchV1TicketsTicketId","security":[],"parameters":[{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"status":{"type":"string","enum":["open","in_progress","waiting","resolved","closed"]},"priority":{"type":"string","enum":["high","medium","low"]},"rootCause":{"type":"string","enum":["none","process","staff","product","system"]},"rootCauseCodeId":{"anyOf":[{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"},{"type":"null"}]},"resolutionCodeId":{"anyOf":[{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"},{"type":"null"}]},"note":{"type":"string","minLength":1,"maxLength":2000},"assigneeId":{"anyOf":[{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/reports/results":{"get":{"tags":["public-api"],"summary":"NPS, CSAT and CES of completed responses from..to (at most 366 days), groupBy none, day, survey, org_unit or channel; filters surveyId, orgUnitId, channel (scope reporting.read, 30 a minute; API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.tickets_reporting is off; rows limited to what the key's creator sees today; 403 API_KEY_CREATOR_FORBIDDEN when the creator no longer holds the scope's permissions in the app (tickets.read: feedback.read; tickets.write: feedback.read and tickets.write; reporting.read: dashboards.read))","operationId":"getV1ReportsResults","security":[],"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/reports/themes":{"get":{"tags":["public-api"],"summary":"Theme counts of completed responses from..to (at most 366 days); filters surveyId, orgUnitId (scope reporting.read, 30 a minute; API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.tickets_reporting is off; rows limited to what the key's creator sees today; 403 API_KEY_CREATOR_FORBIDDEN when the creator no longer holds the scope's permissions in the app (tickets.read: feedback.read; tickets.write: feedback.read and tickets.write; reporting.read: dashboards.read))","operationId":"getV1ReportsThemes","security":[],"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks":{"get":{"tags":["public-api"],"summary":"Outbound webhook endpoints, newest first (at most 200): id, url, events, active, includeContact, disabledAt, consecutiveFailures, createdAt; never a secret (scope webhooks.manage, API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.webhooks_manage is off; 403 WEBHOOKS_FORBIDDEN unless the key's creator still holds integrations.manage)","operationId":"getV1Webhooks","security":[],"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["public-api"],"summary":"Register an endpoint (https, a public host name: the settings screen's URL check, 400 VALIDATION_FAILED otherwise); the whsec_ signing secret is in this response only (scope webhooks.manage, API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.webhooks_manage is off; 403 WEBHOOKS_FORBIDDEN unless the key's creator still holds integrations.manage; writes also need the creator to read and export feedback with no masked field (as in the app), 30 a minute, live keys only; audited)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1Webhooks","security":[],"x-sayvara-contract":{"body":"webhookCreate"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts webhookCreate"}}}},"responses":{"201":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{webhookId}":{"get":{"tags":["public-api"],"summary":"One endpoint; 404 when unknown (scope webhooks.manage, API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.webhooks_manage is off; 403 WEBHOOKS_FORBIDDEN unless the key's creator still holds integrations.manage)","operationId":"getV1WebhooksWebhookId","security":[],"parameters":[{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["public-api"],"summary":"Change the events, includeContact or testEvents; turning includeContact on also needs the creator to hold privacy.manage; an automation hook keeps its one event (409 AUTOMATION_HOOK_EVENTS) (scope webhooks.manage, API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.webhooks_manage is off; 403 WEBHOOKS_FORBIDDEN unless the key's creator still holds integrations.manage; writes also need the creator to read and export feedback with no masked field (as in the app), 30 a minute, live keys only; audited)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1WebhooksWebhookId","security":[],"parameters":[{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"webhookEndpointOptionsUpdate"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts webhookEndpointOptionsUpdate"}}}},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["public-api"],"summary":"Remove the endpoint with its secrets and delivery log (scope webhooks.manage, API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.webhooks_manage is off; 403 WEBHOOKS_FORBIDDEN unless the key's creator still holds integrations.manage; 30 a minute, live keys only; audited)","operationId":"deleteV1WebhooksWebhookId","security":[],"parameters":[{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{webhookId}/options":{"get":{"tags":["public-api"],"summary":"The events the endpoint receives, whether events about a contact carry data.contact, and whether it also receives test-mode events (testEvents) (scope webhooks.manage, API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.webhooks_manage is off; 403 WEBHOOKS_FORBIDDEN unless the key's creator still holds integrations.manage)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1WebhooksWebhookIdOptions","security":[],"parameters":[{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"webhookEndpointOptions"},"responses":{"200":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{webhookId}/rotate-secret":{"post":{"tags":["public-api"],"summary":"New signing secret, in this response only; the older ones keep signing (second v1=) for 24 h (scope webhooks.manage, API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.webhooks_manage is off; 403 WEBHOOKS_FORBIDDEN unless the key's creator still holds integrations.manage; writes also need the creator to read and export feedback with no masked field (as in the app), 30 a minute, live keys only; audited)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1WebhooksWebhookIdRotateSecret","security":[],"parameters":[{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"webhookSecretRotated"},"responses":{"201":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/webhooks/{webhookId}/test-event":{"post":{"tags":["public-api"],"summary":"Queue one test delivery of the chosen event (body {type}) to this endpoint: the event's sample data with fresh ids, test: true and the header Sayvara-Test; answers {webhookId, eventId, type, status: queued}. 404 also while the switch api.webhook_test_events is off; 409 WEBHOOK_INACTIVE when switched off, 409 TEST_EVENTS_OFF unless testEvents is on, 422 EVENT_NOT_SUBSCRIBED, 422 AUTOMATION_HOOK_PLAN for an automation hook while the plan lacks api_access (it receives nothing) (scope webhooks.manage, API key or OAuth client bearer, plan api_access; 404 while the organisation's switch api.webhooks_manage is off; 403 WEBHOOKS_FORBIDDEN unless the key's creator still holds integrations.manage; 10 a minute per key and 10 a minute per organisation, shared with the app's route, 429 RATE_LIMITED; live or test keys; audited)","operationId":"postV1WebhooksWebhookIdTestEvent","security":[],"parameters":[{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Success"},"429":{"description":"Too many requests: `RATE_LIMITED` (the per-minute limit) or `API_QUOTA_EXCEEDED` (the monthly quota; `details.limit` is the quota). Wait for the `Retry-After` seconds, then try again. The API sends it; while limits at the edge in front of the API are on, the edge can send the same answer for an API key whose answers carry the `RateLimit` headers (while limits by plan or monthly quotas are on for the organisation), before the call reaches the API (its per-minute `Retry-After` is 60, the longest wait, and it adds the `RateLimit` headers). A call the edge refuses is not counted by the API. See the help page API > Rate limits.","headers":{"Retry-After":{"description":"Seconds to wait before trying again. Always sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Limit":{"description":"The limit the answer is about (calls): from the API, the one closest to being reached; on the edge's per-minute 429, the per-minute limit. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Remaining":{"description":"Calls left in that limit: 0 on a 429. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Reset":{"description":"Seconds until that limit resets. Sometimes sent.","schema":{"type":"integer","minimum":0}},"RateLimit-Policy":{"description":"Each limit and its window, e.g. `300;w=60, 100000;w=1296000`. Sometimes sent.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/webhook-endpoints/{webhookId}/test-event":{"post":{"tags":["setup"],"summary":"The app's Send test event: the same test delivery and errors as POST /v1/webhooks/{webhookId}/test-event, for a member with integrations.manage (422 AUTOMATION_HOOK_PLAN for an automation hook while the plan lacks api_access); 404 while api.webhook_test_events is off; 10 a minute per organisation shared with the API-key route (429 RATE_LIMITED); audited","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewsWebhookEndpointsWebhookIdTestEvent","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/credential-health":{"get":{"tags":["integrations"],"summary":"The organisation's credentials with a known expiry or a provider refusal (API keys, own SMS sender IDs, chat, CRM and connector connections), most urgent first, with counts by state (ok, expiring within 14 days, expired, failing); 404 while the switch integrations.credential_alerts is off; members who see the whole organisation only (403 TENANT_WIDE_ONLY)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReviewsCredentialHealth","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"credentialHealthList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/desk-tickets":{"get":{"tags":["integrations"],"summary":"Telvory Desk connection: state, the switches \"a Desk ticket per detractor\" and \"the Telyzer recording link on it\", whether Telyzer is connected, last test; 404 while the install has no Desk API and the tenant is not connected","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdReviewsDeskTickets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["integrations"],"summary":"Connect or reconnect with the workspace key (vault only) and the two switches (off by default); tests the key; keeps the stored reopen settings and endpoint secret","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdReviewsDeskTickets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["integrations"],"summary":"Pause or resume ({ status }) or change the switches ({ ticketOnDetractor, recordingLink }); turning detractor tickets on starts from now; audited","description":"Permission: `integrations.manage`.","operationId":"patchV1TenantsTenantIdReviewsDeskTickets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect (the vault secrets go too)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdReviewsDeskTickets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/desk-tickets/test":{"post":{"tags":["integrations"],"summary":"Test the stored key again","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewsDeskTicketsTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/marketplace/microsoft/landing":{"get":{"tags":["billing"],"summary":"Landing page of the Microsoft marketplace offer: resolves ?token= with Microsoft, stores the subscription (pending) and redirects to the app with a one-time link code (24 h) in the fragment; otherwise redirects with ?marketplace=linked, ended, invalid or unavailable (404 unless MS_MARKETPLACE_ENABLED; 503 MARKETPLACE_UNAVAILABLE when Microsoft or the control plane is not reachable or configured)","operationId":"getV1MarketplaceMicrosoftLanding","security":[],"responses":{"303":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/marketplace/microsoft/webhook":{"post":{"tags":["billing"],"summary":"Microsoft marketplace webhook (ChangePlan, ChangeQuantity, Suspend, Reinstate, Unsubscribe, Renew): Entra bearer token of the publisher's app (401 MARKETPLACE_CALLER_REFUSED), the operation confirmed with Microsoft before it is stored, ChangePlan / ChangeQuantity PATCHed Success, or Failure (outcome rejected, not stored) when an organisation billed through the marketplace would move to a plan or quantity that does not map to its Sayvara plan; answers the outcome (404 unless MS_MARKETPLACE_ENABLED; 503 MARKETPLACE_UNAVAILABLE when Microsoft or the control plane is not reachable or configured)","operationId":"postV1MarketplaceMicrosoftWebhook","security":[{"signature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/marketplace/microsoft/link":{"post":{"tags":["billing"],"summary":"Link a resolved Microsoft marketplace subscription to this organisation with its link code and activate it with Microsoft (status active, or linked when Microsoft could not be reached: retried hourly); 404 MARKETPLACE_LINK_INVALID, 409 MARKETPLACE_ALREADY_LINKED / MARKETPLACE_TENANT_UNKNOWN, 409 MARKETPLACE_PLAN_MISMATCH {reason: unmapped, plan, quantity, addons, no_subscription, pending_change, margin} when the Microsoft plan does not map to the organisation's own Sayvara plan or its Microsoft price is under the 25 % margin floor (every plan while the plan map is empty); audited (404 unless MS_MARKETPLACE_ENABLED; 503 MARKETPLACE_UNAVAILABLE when Microsoft or the control plane is not reachable or configured)","description":"Permission: `billing.manage`.","operationId":"postV1TenantsTenantIdMarketplaceMicrosoftLink","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}},"required":["code"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/integration-health":{"get":{"tags":["integrations"],"summary":"Every stored connection with its health: ok, failing, expiring, expired or unchecked; last scheduled check and its code, last success, failures in a row, credential expiry date, last event (24 h figures null: no per-event history), the last 7 days (window7d: scheduled checks of the last 168 hours and failed checks, connector_daily events received and failures over today and the 6 UTC days before, null when not counted; errorRate7d = failed checks ÷ checks, null without checks); the outbound webhook endpoints (host only, live, paused or disabled, last delivery, dead letters in a row, deliveries of the last 24 h without test events, failed = retrying or dead, error rate rounded to 3 decimals, null without deliveries; at most 200, webhooksTruncated; events7d and errorRate7d over 7 days); and each product of ours the tenant set up, with or without events (products: source, last event, events7d failed = processing failed or ignored as INVALID_JOB, other ignored events being business skips, errorRate7d); never payloads, URLs or secrets; members who see the whole organisation only (403 TENANT_WIDE_ONLY); 404 unless the tenant flag integrations.health is on","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReviewsIntegrationHealth","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"integrationHealthList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/integration-health/{connectorId}/credential-expiry":{"put":{"tags":["integrations"],"summary":"Record or clear the date the connection's credential stops working; the owners and admins get one email 14 days before; audited; members who see the whole organisation only (403 TENANT_WIDE_ONLY); 404 unless the tenant flag integrations.health is on","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdReviewsIntegrationHealthConnectorIdCredentialExpiry","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectorId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"integrationExpiryBody","response":"integrationHealthItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts integrationExpiryBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/integration-health/omnibrand-attention":{"get":{"tags":["integrations"],"summary":"OmniBrand accounts that feed Sayvara and need attention, for the in-app banner: { accounts: [{ accountId, platform, name, health (EXPIRING, EXPIRED or REVOKED as OmniBrand reports the account's token), severity (red: EXPIRED or REVOKED, the owners and admins got one email for the episode; amber: EXPIRING, no email), since (when the episode started) }] }, red first, oldest first; kept by the integration health scan (accounts pulled from OmniBrand at most hourly), no OmniBrand call here; an account that reads healthy again leaves the list; no stored OmniBrand connection answers no accounts; members who see the whole organisation only (403 TENANT_WIDE_ONLY); 404 unless the tenant flag integrations.health is on","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdReviewsIntegrationHealthOmnibrandAttention","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/m365-mailbox":{"get":{"tags":["messaging"],"summary":"Own Microsoft 365 mailbox: whether it is turned on for the organisation (flag messaging.m365_mailbox), whether Sayvara's Microsoft app is available, and the connected mailbox","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdReviewsM365Mailbox","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["messaging"],"summary":"Forget the connected mailbox; audited","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdReviewsM365Mailbox","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/m365-mailbox/start":{"post":{"tags":["messaging"],"summary":"Start \"Connect your Microsoft 365 mailbox\" for { mailbox }: answers the Microsoft sign-in URL; 404 while turned off, 501 M365_APP_NOT_AVAILABLE","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewsM365MailboxStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reviews/m365-mailbox/test":{"post":{"tags":["messaging"],"summary":"Send a test e-mail from the connected mailbox to the signed-in user's own verified address (strictly empty body): { ok, code?, status }; 404 while turned off, 501 M365_APP_NOT_AVAILABLE, 409 M365_MAILBOX_NOT_CONNECTED or M365_TEST_EMAIL_UNVERIFIED, 429 over 10 per hour per organisation or 5 per user; audited","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdReviewsM365MailboxTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/connect/m365-mailbox/callback":{"get":{"tags":["messaging"],"summary":"Microsoft's return (sign-in, then admin consent); redirects to Settings with m365=connected or m365=error&code=<code>","operationId":"getV1ConnectM365MailboxCallback","security":[],"responses":{"303":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox":{"get":{"tags":["inbox"],"summary":"The unified inbox: tickets and their conversations, survey comments without a ticket, reviews, DM threads and customer messages no flow took (tenant-wide users) the caller may see, newest first or (sort=sla) by ticket due time, with overdue and inbox-tag filters; each item carries its tag ids (cursor paging)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdInbox","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":2048}},{"name":"limit","in":"query","required":false,"schema":{"default":25,"type":"integer","minimum":1,"maximum":50}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"channel","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"state","in":"query","required":false,"schema":{"default":"open","type":"string","enum":["open","done","snoozed","all"]}},{"name":"assignee","in":"query","required":false,"schema":{"anyOf":[{"type":"string","enum":["me","unassigned"]},{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}]}},{"name":"unread","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}},{"name":"hasTicket","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}},{"name":"unit","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"}},{"name":"recent","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}},{"name":"sort","in":"query","required":false,"schema":{"default":"recent","type":"string","enum":["recent","sla"]}},{"name":"overdue","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}},{"name":"tag","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/counts":{"get":{"tags":["inbox"],"summary":"Open threads per kind and the caller's unread, mine and unassigned, among threads with activity in the last 90 days (each stops at 100; kept 10 seconds per user)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdInboxCounts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/threads/{kind}/{key}":{"get":{"tags":["inbox"],"summary":"One inbox thread: its item, the comment or review text and where to open it","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdInboxThreadsKindKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["inbox"],"summary":"Triage a thread: status, snooze, assignee (non-ticket threads) and the linked ticket, which must be the same customer's (409 bad_ticket; a review cannot be linked)","description":"Permission: `tickets.write`.","operationId":"patchV1TenantsTenantIdInboxThreadsKindKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"status":{"type":"string","enum":["open","done","snoozed"]},"snoozedUntil":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"assigneeMembershipId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"linkedTicketId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/threads/{kind}/{key}/read":{"put":{"tags":["inbox"],"summary":"Mark a thread read through a time, or unread again (for the caller only)","description":"Permission: `feedback.read`.","operationId":"putV1TenantsTenantIdInboxThreadsKindKeyRead","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"readThrough":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["readThrough"],"additionalProperties":false},{"type":"object","properties":{"unread":{"type":"boolean","const":true}},"required":["unread"],"additionalProperties":false}]}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/batch":{"post":{"tags":["inbox"],"summary":"One change on up to 50 threads (assign, done, open, snooze, tag, untag: tickets.write too; read, unread: for the caller only), each through its single-thread rules; 200 with each thread's outcome (ok, or the code its own route would answer, e.g. NOT_FOUND or use_ticket_assign)","description":"Permission: `feedback.read`.","operationId":"postV1TenantsTenantIdInboxBatch","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","oneOf":[{"type":"object","properties":{"items":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["ticket","response","review","dm","unmatched"]},"key":{"type":"string","minLength":1,"maxLength":400,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"}},"required":["kind","key"],"additionalProperties":false}},"action":{"type":"string","const":"assign"},"assigneeMembershipId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["items","action","assigneeMembershipId"],"additionalProperties":false},{"type":"object","properties":{"items":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["ticket","response","review","dm","unmatched"]},"key":{"type":"string","minLength":1,"maxLength":400,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"}},"required":["kind","key"],"additionalProperties":false}},"action":{"type":"string","const":"snooze"},"snoozedUntil":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["items","action","snoozedUntil"],"additionalProperties":false},{"type":"object","properties":{"items":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["ticket","response","review","dm","unmatched"]},"key":{"type":"string","minLength":1,"maxLength":400,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"}},"required":["kind","key"],"additionalProperties":false}},"action":{"type":"string","enum":["done","open","read","unread"]}},"required":["items","action"],"additionalProperties":false},{"type":"object","properties":{"items":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["ticket","response","review","dm","unmatched"]},"key":{"type":"string","minLength":1,"maxLength":400,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"}},"required":["kind","key"],"additionalProperties":false}},"action":{"type":"string","enum":["tag","untag"]},"tagId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["items","action","tagId"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/saved-replies":{"get":{"tags":["inbox"],"summary":"The organisation's saved replies for the reply box (title, English and / or Arabic text; at most 200)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdInboxSavedReplies","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["inbox"],"summary":"Add a saved reply (owners and admins; 409 title_taken, 409 too_many past 200); audited without its text","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdInboxSavedReplies","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},"bodyEn":{"anyOf":[{"type":"string","maxLength":1200,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},{"type":"null"}]},"bodyAr":{"anyOf":[{"type":"string","maxLength":1200,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},{"type":"null"}]}},"required":["title"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/saved-replies/{id}":{"patch":{"tags":["inbox"],"summary":"Change a saved reply (owners and admins); audited without its text","description":"Permission: `tenant.update`.","operationId":"patchV1TenantsTenantIdInboxSavedRepliesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},"bodyEn":{"anyOf":[{"type":"string","maxLength":1200,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},{"type":"null"}]},"bodyAr":{"anyOf":[{"type":"string","maxLength":1200,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["inbox"],"summary":"Remove a saved reply (owners and admins)","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdInboxSavedRepliesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/threads/{kind}/{key}/notes":{"get":{"tags":["inbox"],"summary":"The team's notes on a non-ticket thread, oldest first (never sent to the customer; 409 use_ticket_notes on a ticket)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdInboxThreadsKindKeyNotes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["inbox"],"summary":"Add a team note to a non-ticket thread (at most 2000 characters, 200 per thread); audited without its text","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdInboxThreadsKindKeyNotes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":2000,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"}},"required":["body"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/threads/{kind}/{key}/notes/{id}":{"delete":{"tags":["inbox"],"summary":"Remove a team note (its author, or an owner or admin)","description":"Permission: `tickets.write`.","operationId":"deleteV1TenantsTenantIdInboxThreadsKindKeyNotesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/threads/{kind}/{key}/reply":{"post":{"tags":["inbox"],"summary":"Reply to the customer on the thread's ticket, through the ticket reply path (opt-out, quiet hours and the WhatsApp window apply)","description":"Permission: `tickets.write`.","operationId":"postV1TenantsTenantIdInboxThreadsKindKeyReply","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":1000},"lang":{"type":"string","enum":["en","ar"]},"requestKey":{"type":"string","minLength":8,"maxLength":100,"pattern":"^[A-Za-z0-9_-]+$"}},"required":["body","lang","requestKey"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/views":{"get":{"tags":["inbox"],"summary":"Saved inbox views: the organisation's shared views first, then the caller's own, each in their order","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdInboxViews","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["inbox"],"summary":"Save the filter bar as a view: private (at most 30 per person) or, for owners and admins, shared (at most 50; 403 shared_needs_admin, 409 name_taken, 409 too_many); audited without its name or search words","description":"Permission: `feedback.read`.","operationId":"postV1TenantsTenantIdInboxViews","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},"shared":{"default":false,"type":"boolean"},"filter":{"type":"object","properties":{"v":{"type":"number","const":1},"kind":{"anyOf":[{"type":"string","enum":["ticket","response","review","dm","unmatched"]},{"type":"null"}]},"channel":{"anyOf":[{"type":"string","enum":["whatsapp","sms","email","web","qr","widget","voice","kiosk","in_app","social","complaint","google_business","app_store","google_play","instagram","messenger","rcs","apple_messages"]},{"type":"null"}]},"state":{"type":"string","enum":["open","done","snoozed","all"]},"assignee":{"anyOf":[{"anyOf":[{"type":"string","enum":["me","unassigned"]},{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}]},{"type":"null"}]},"unread":{"type":"boolean"},"hasTicket":{"type":"boolean"},"unit":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"tag":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"q":{"type":"string","maxLength":100,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},"sort":{"type":"string","enum":["recent","sla"]},"overdue":{"type":"boolean"}},"required":["v","kind","channel","state","assignee","unread","hasTicket","unit","tag","q","sort","overdue"],"additionalProperties":false}},"required":["name","filter"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/views/order":{"put":{"tags":["inbox"],"summary":"Put the caller's own views, or (owners and admins) the shared views, in a new order (409 order_mismatch unless ids is exactly that set)","description":"Permission: `feedback.read`.","operationId":"putV1TenantsTenantIdInboxViewsOrder","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"shared":{"type":"boolean"},"ids":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["shared","ids"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/views/{id}":{"patch":{"tags":["inbox"],"summary":"Rename a saved view or change its filters (own views; shared views: owners and admins)","description":"Permission: `feedback.read`.","operationId":"patchV1TenantsTenantIdInboxViewsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},"filter":{"type":"object","properties":{"v":{"type":"number","const":1},"kind":{"anyOf":[{"type":"string","enum":["ticket","response","review","dm","unmatched"]},{"type":"null"}]},"channel":{"anyOf":[{"type":"string","enum":["whatsapp","sms","email","web","qr","widget","voice","kiosk","in_app","social","complaint","google_business","app_store","google_play","instagram","messenger","rcs","apple_messages"]},{"type":"null"}]},"state":{"type":"string","enum":["open","done","snoozed","all"]},"assignee":{"anyOf":[{"anyOf":[{"type":"string","enum":["me","unassigned"]},{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}]},{"type":"null"}]},"unread":{"type":"boolean"},"hasTicket":{"type":"boolean"},"unit":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"tag":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"q":{"type":"string","maxLength":100,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},"sort":{"type":"string","enum":["recent","sla"]},"overdue":{"type":"boolean"}},"required":["v","kind","channel","state","assignee","unread","hasTicket","unit","tag","q","sort","overdue"],"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["inbox"],"summary":"Delete a saved view (own views; shared views: owners and admins)","description":"Permission: `feedback.read`.","operationId":"deleteV1TenantsTenantIdInboxViewsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/tags":{"get":{"tags":["inbox"],"summary":"The organisation's inbox tags (English and / or Arabic name, colour; at most 100, 10 per conversation)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdInboxTags","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["inbox"],"summary":"Add an inbox tag (owners and admins; 400 needs_name, 409 name_taken, 409 too_many past 100); audited without its name","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdInboxTags","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nameEn":{"anyOf":[{"type":"string","minLength":1,"maxLength":40,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},{"type":"string","const":""},{"type":"null"}]},"nameAr":{"anyOf":[{"type":"string","minLength":1,"maxLength":40,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},{"type":"string","const":""},{"type":"null"}]},"colour":{"type":"string","enum":["slate","blue","teal","green","amber","orange","red","purple"]}},"required":["colour"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/tags/{id}":{"patch":{"tags":["inbox"],"summary":"Rename or recolour an inbox tag (owners and admins); audited without its name","description":"Permission: `tenant.update`.","operationId":"patchV1TenantsTenantIdInboxTagsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"nameEn":{"anyOf":[{"type":"string","minLength":1,"maxLength":40,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},{"type":"string","const":""},{"type":"null"}]},"nameAr":{"anyOf":[{"type":"string","minLength":1,"maxLength":40,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},{"type":"string","const":""},{"type":"null"}]},"colour":{"type":"string","enum":["slate","blue","teal","green","amber","orange","red","purple"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["inbox"],"summary":"Delete an inbox tag and take it off every conversation (owners and admins; 409 tag_in_rule while an assignment rule uses it)","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdInboxTagsId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/threads/{kind}/{key}/tags/{tagId}":{"put":{"tags":["inbox"],"summary":"Put an inbox tag on a conversation the caller can see (idempotent; 409 bad_tag, 409 too_many_tags past 10)","description":"Permission: `tickets.write`.","operationId":"putV1TenantsTenantIdInboxThreadsKindKeyTagsTagId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"tagId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["inbox"],"summary":"Take an inbox tag off a conversation the caller can see (idempotent)","description":"Permission: `tickets.write`.","operationId":"deleteV1TenantsTenantIdInboxThreadsKindKeyTagsTagId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"tagId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/assign-rules":{"get":{"tags":["inbox"],"summary":"Auto-assign rules for conversations that are not tickets (owners and admins), in their order, and since when rules have been on","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdInboxAssignRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["inbox"],"summary":"Add an auto-assign rule: which survey comments, reviews, DMs or unmatched messages (kinds, channels, branch, tag) go to one person or in turns (409 too_many past 50, name_taken, bad_member, bad_unit, bad_tag); never tickets; audited without its name","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdInboxAssignRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},"enabled":{"default":true,"type":"boolean"},"match":{"type":"object","properties":{"kinds":{"maxItems":4,"type":"array","items":{"type":"string","enum":["response","review","dm","unmatched"]}},"channels":{"maxItems":16,"type":"array","items":{"type":"string","enum":["whatsapp","sms","email","web","qr","widget","voice","kiosk","in_app","social","complaint","google_business","app_store","google_play","instagram","messenger","rcs","apple_messages"]}},"unitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"tagId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["kinds","channels","unitId","tagId"],"additionalProperties":false},"action":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","const":"member"},"memberIds":{"minItems":1,"maxItems":1,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["mode","memberIds"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","const":"round_robin"},"memberIds":{"minItems":2,"maxItems":20,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["mode","memberIds"],"additionalProperties":false}]}},"required":["name","match","action"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/assign-rules/order":{"put":{"tags":["inbox"],"summary":"Put the auto-assign rules in a new order: the first that matches wins (409 order_mismatch unless ids is exactly the set)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdInboxAssignRulesOrder","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"ids":{"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["ids"],"additionalProperties":false}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/inbox/assign-rules/{id}":{"patch":{"tags":["inbox"],"summary":"Change, turn on or turn off an auto-assign rule (owners and admins); audited without its name","description":"Permission: `tenant.update`.","operationId":"patchV1TenantsTenantIdInboxAssignRulesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[^\\u0000-\\u001f\\u007f]*$"},"enabled":{"type":"boolean"},"match":{"type":"object","properties":{"kinds":{"maxItems":4,"type":"array","items":{"type":"string","enum":["response","review","dm","unmatched"]}},"channels":{"maxItems":16,"type":"array","items":{"type":"string","enum":["whatsapp","sms","email","web","qr","widget","voice","kiosk","in_app","social","complaint","google_business","app_store","google_play","instagram","messenger","rcs","apple_messages"]}},"unitId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"tagId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["kinds","channels","unitId","tagId"],"additionalProperties":false},"action":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","const":"member"},"memberIds":{"minItems":1,"maxItems":1,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["mode","memberIds"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","const":"round_robin"},"memberIds":{"minItems":2,"maxItems":20,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["mode","memberIds"],"additionalProperties":false}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["inbox"],"summary":"Delete an auto-assign rule; conversations it gave out keep their assignee","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdInboxAssignRulesId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/onboarding":{"get":{"tags":["onboarding"],"summary":"Owners only (403 owners_only): the organisation's eight set-up steps (structure, team, channel, survey, source, rules, followup, test), each done or not by the organisation's own data, with the count it is judged by","description":"Permission: `tenant.read`.","operationId":"getV1TenantsTenantIdOnboarding","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/hooks/meet/telvory/{tenantId}":{"post":{"tags":["integrations"],"summary":"Telvory Meetings webhook (X-Telvory-Signature v1, 5-minute window): meeting.ended queues a survey for each participant who gave follow-up consent and an email or phone; Send-test deliveries, the .ready events and a paused connection (200 ignored, reason paused) queue nothing; 409 MEET_EVENT_IN_FLIGHT with Retry-After while the same event is still being processed; 404 when there is no connection","operationId":"postV1HooksMeetTelvoryTenantId","security":[{"signature":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/meet/connection":{"get":{"tags":["integrations"],"summary":"The Telvory Meetings connection: state, the webhook URL to register at Telvory, the chosen survey, the last test and why the last meeting got no survey (404 while the connector is not offered to the organisation)","description":"Permission: `integrations.manage`.","operationId":"getV1TenantsTenantIdMeetConnection","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["integrations"],"summary":"Connect or reconnect with the organisation's Telvory key (meetings:read) and the webhook endpoint secret; tests the key; a surveyId must be a live survey (400 SURVEY_NOT_LIVE); 409 MEET_CONNECTION_BUSY while another change runs","description":"Permission: `integrations.manage`.","operationId":"putV1TenantsTenantIdMeetConnection","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"apiKey":{"type":"string","pattern":"^tvk_(live|test)_[A-Za-z0-9_-]{16,200}$"},"webhookSecret":{"type":"string","minLength":16,"maxLength":512},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["apiKey","webhookSecret"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["integrations"],"summary":"Pause or resume ({ status }), or choose the survey ({ surveyId }: a live survey, else 400 SURVEY_NOT_LIVE; null = the only live survey)","description":"Permission: `integrations.manage`.","operationId":"patchV1TenantsTenantIdMeetConnection","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect (the vault secrets go too)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdMeetConnection","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/meet/connection/test":{"post":{"tags":["integrations"],"summary":"Test the stored Telvory key again (invalid_key, missing_scope, unreachable)","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdMeetConnectionTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/billing/hooks/moyasar":{"post":{"tags":["billing"],"summary":"Moyasar payment webhook (shared secret token; books only payments tagged platform and product = sayvara)","operationId":"postV1BillingHooksMoyasar","security":[{"signature":[]}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/api-keys/usage":{"get":{"tags":["api-keys"],"summary":"Public API limits by plan: requests per key per minute (flag public_api.plan_limits), the monthly quota and live calls this month (flag public_api.monthly_quota)","description":"Permission: `api_keys.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdApiKeysUsage","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"apiUsage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/openapi.json":{"get":{"tags":["health"],"summary":"This document","operationId":"getV1OpenapiJson","security":[],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/contact":{"post":{"tags":["public"],"summary":"Contact form of sayvara.com and sa.sayvara.com (403 TURNSTILE_FAILED when the human check fails or, in production, cannot be completed)","operationId":"postV1PublicContact","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","maxLength":254},"company":{"type":"string","minLength":1,"maxLength":200},"jobTitle":{"type":"string","minLength":1,"maxLength":200},"job_title":{"type":"string","minLength":1,"maxLength":200},"org_type":{"type":"string","enum":["government","enterprise","other"]},"sector":{"type":"string","minLength":1,"maxLength":100},"channels":{"maxItems":5,"type":"array","items":{"type":"string","enum":["whatsapp","sms","email","web","qr"]}},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"phone":{"anyOf":[{"type":"string","maxLength":32,"pattern":"^\\+?[0-9 ()-]{6,32}$"},{"type":"string","const":""}]},"topic":{"type":"string","enum":["briefing","early-access","demo","sales","security","api","partners","privacy","press","other"]},"message":{"type":"string","minLength":1,"maxLength":5000},"locale":{"type":"string","enum":["ar","en"]},"path":{"type":"string","maxLength":300},"page":{"type":"string","maxLength":300},"website":{"type":"string","maxLength":500},"turnstileToken":{"type":"string","maxLength":4096}},"required":["name","email","company","country","topic","message","locale"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/hooks/{source}":{"post":{"tags":["hooks"],"summary":"Signed event from Telyzer, Telvory Desk or OmniBrand (@sayvara/contracts)","operationId":"postV1HooksSource","security":[{"signature":[]}],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}}],"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/hooks/{source}/{connectionId}":{"post":{"tags":["hooks"],"summary":"Signed event to one connection's own URL, checked with that connection's secret (PL-10); an unknown connection answers like a wrong signature","operationId":"postV1HooksSourceConnectionId","security":[{"signature":[]}],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/insights/summary":{"get":{"tags":["insights"],"summary":"NPS, CSAT, CES, responses and loop closed with deltas and sparklines (a paired TV display may read it)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdInsightsSummary","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"insightsQuery","response":"insightsSummary"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/insights/trend":{"get":{"tags":["insights"],"summary":"NPS per day against the previous period (a paired TV display with this panel may read it)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdInsightsTrend","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"insightsQuery","response":"insightsTrend"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/insights/themes":{"get":{"tags":["insights"],"summary":"Theme mentions (empty until AI text insights run) (a paired TV display with this panel may read it)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdInsightsThemes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"insightsQuery","response":"insightsThemes"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/insights/channel-mix":{"get":{"tags":["insights"],"summary":"Completed responses per channel (?split=kind also splits phone and field answers by how they were taken)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdInsightsChannelMix","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"insightsChannelMixQuery","response":"insightsChannelMix"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/insights/sources":{"get":{"tags":["insights"],"summary":"Reports by code: answers and scores per QR code, branch, counter or employee","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdInsightsSources","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"insightsSourcesQuery","response":"insightsSources"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/drop-off":{"get":{"tags":["insights"],"summary":"Quit and screen-out report for one survey (RP-16)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportsDropOff","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"dropOffQuery","response":"dropOffReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/started-counts":{"get":{"tags":["insights"],"summary":"Answers started in the period per survey (the drop-off report's started count), busiest first","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportsStartedCounts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"startedCountsQuery","response":"startedCounts"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/ticket-performance":{"get":{"tags":["insights"],"summary":"Agent and team performance on follow-up tickets (CL-23; 403 ENTITLEMENT_REQUIRED without the plan key)","description":"Permission: `members.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportsTicketPerformance","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"ticketPerformanceQuery","response":"ticketPerformanceReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/questions":{"get":{"tags":["insights"],"summary":"Question results for one survey: every question type, loop rounds per option","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportsQuestions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"questionResultsQuery","response":"questionResultsReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/quotas":{"get":{"tags":["insights"],"summary":"Quota progress for one survey (SV-09): limit, full, counted in your branches; survey-wide fill for owners and admins","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportsQuotas","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"quotaProgressQuery","response":"quotaProgressReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/phone-surveys":{"get":{"tags":["insights"],"summary":"Phone survey report (CH-10): answered calls, how they ended, scores and questions, for one or every phone survey","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportsPhoneSurveys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"phoneSurveyQuery","response":"phoneSurveyReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dashboard-links":{"get":{"tags":["insights"],"summary":"Shared dashboard links (RP-14): your own; owners and admins see everyone's","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdDashboardLinks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"dashboardLinkList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["insights"],"summary":"Make a view-only dashboard link (the full link is in this answer only; 403 ENTITLEMENT_REQUIRED, 409 SHARED_LINK_LIMIT)","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdDashboardLinks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"dashboardLinkCreate","response":"dashboardLinkCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts dashboardLinkCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/dashboard-links/{linkId}/revoke":{"post":{"tags":["insights"],"summary":"Stop a shared dashboard link","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdDashboardLinksLinkIdRevoke","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"linkId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"dashboardLinkRevoke","response":"dashboardLinkItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts dashboardLinkRevoke"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/shared-dashboards/open":{"post":{"tags":["insights"],"summary":"Open a shared dashboard without signing in (404 invalid, 401 passcode, 410 no longer available); every opening is audited","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SharedDashboardsOpen","security":[],"x-sayvara-contract":{"body":"sharedDashboardOpen","response":"sharedDashboard"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sharedDashboardOpen"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/responses":{"get":{"tags":["responses"],"summary":"Responses, newest first (cursor paged)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdResponses","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"responseQuery","response":"responseList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/responses/{responseId}":{"get":{"tags":["responses"],"summary":"One response with answers, questions and triggers","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdResponsesResponseId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"responseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"responseDetail"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/responses/exports":{"post":{"tags":["responses"],"summary":"Export the filtered responses as CSV (201 ready with a 1-hour link; 202 queued for a large set; 422 EXPORT_TOO_LARGE)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdResponsesExports","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"responseExportCreate","response":"responseExportItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts responseExportCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/responses/exports/{exportId}":{"get":{"tags":["responses"],"summary":"One of your exports, with a fresh download link once ready","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdResponsesExportsExportId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"exportId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"responseExportItem"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/live":{"get":{"tags":["responses"],"summary":"Live feed (text/event-stream): ready, reset, response, ticket, inbox (review / DM bump, tenant-wide members only); row events carry ids, a reconnect with Last-Event-ID or ?since= replays the last 5 minutes of its scope (reset when too old); at most 4 writes a second","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdLive","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"liveEvent"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/wall/praise":{"get":{"tags":["insights"],"summary":"TV: recent praise, masked (first letters, no numbers or addresses); for the praise panel and ticker","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWallPraise","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"wallQuery","response":"wallAnswerList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/wall/detractors":{"get":{"tags":["insights"],"summary":"TV: unhappy customers waiting (open follow-ups, closest to the SLA first), masked; 403 DISPLAY_PANEL_NOT_ALLOWED for a display without the panel","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWallDetractors","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"wallQuery","response":"wallTicketList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/wall/feed":{"get":{"tags":["insights"],"summary":"TV: the latest answers, masked; 403 DISPLAY_PANEL_NOT_ALLOWED for a display without the panel","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWallFeed","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"wallQuery","response":"wallAnswerList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/demo-access":{"get":{"tags":["setup"],"summary":"Whether this is a demo organisation and the signed-in person a demo-only guest (the screens then show changes read-only)","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdDemoAccess","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"demoAccess"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/wall/shoutouts":{"get":{"tags":["insights"],"summary":"TV: approved staff shout-outs of staff who agreed, by first name and branch, customer masked; a display needs the praise panel","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWallShoutouts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"wallQuery","response":"wallShoutoutList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/shoutouts":{"get":{"tags":["tickets"],"summary":"Staff shout-outs found in customers' praise, in your units (status filter); with the number waiting for a decision","description":"Permission: `coaching.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdFrontlineShoutouts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"shoutoutQuery","response":"shoutoutList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/shoutouts/{id}/decision":{"post":{"tags":["tickets"],"summary":"Approve or reject a shout-out (403 SHOUTOUT_OWN for your own, 409 SHOUTOUT_DECIDED); an approved one thanks the employee once","description":"Permission: `coaching.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdFrontlineShoutoutsIdDecision","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"shoutoutDecision","response":"shoutoutItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts shoutoutDecision"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/shoutouts/mine":{"get":{"tags":["tickets"],"summary":"Your own approved shout-outs (the in-app thank-you)","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdFrontlineShoutoutsMine","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"shoutoutList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/shoutouts/settings":{"get":{"tags":["tickets"],"summary":"Shout-out settings: automatic approval, thank-you message","description":"Permission: `coaching.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdFrontlineShoutoutsSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"shoutoutSettings"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["tickets"],"summary":"Change the shout-out settings (owners and admins)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdFrontlineShoutoutsSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"shoutoutSettingsPut","response":"shoutoutSettings"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts shoutoutSettingsPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/shoutouts/staff":{"get":{"tags":["tickets"],"summary":"Members a shout-out may name, in your units, with the other names customers use","description":"Permission: `coaching.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdFrontlineShoutoutsStaff","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"shoutoutStaffList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/shoutouts/staff/{membershipId}":{"put":{"tags":["tickets"],"summary":"Turn shout-outs on or off for a member, set their other names and whether the wall shows them","description":"Permission: `coaching.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdFrontlineShoutoutsStaffMembershipId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"membershipId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"shoutoutStaffPut","response":"shoutoutStaffItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts shoutoutStaffPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/wall/live":{"get":{"tags":["insights"],"summary":"TV: masked live stream (text/event-stream): ready, answer, ticket; a display is re-checked every 60 s and the stream ends when it is revoked","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWallLive","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"wallLiveEvent"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets":{"get":{"tags":["tickets"],"summary":"Follow-up tickets, newest first; status=unresolved (open, in progress, waiting) lists the most overdue first (cursor paged)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTickets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"ticketQuery","response":"ticketList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/counts":{"get":{"tags":["tickets"],"summary":"Tickets per status","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketsCounts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ticketCounts"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/due":{"get":{"tags":["tickets"],"summary":"Open tickets by SLA state (on time, at risk, breached) and the ones due soonest (RP-01 Home)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketsDue","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"ticketDueQuery","response":"ticketDue"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/{ticketId}":{"get":{"tags":["tickets"],"summary":"One ticket with its timeline and response","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketsTicketId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ticketDetail"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["tickets"],"summary":"Work a ticket: status, assignee, root cause, priority, note. Optional Idempotency-Key header (8-128 visible ASCII): a repeat on the same ticket changes nothing and answers the ticket as it is; on another ticket 422 IDEMPOTENCY_KEY_REUSED. Optional If-Match header (the ticket updatedAt the caller saw, as GET frontline/today lists it): 409 TICKET_CHANGED with details { status, updatedAt } when the ticket changed since","description":"Permission: `tickets.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdTicketsTicketId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ticketPatch","response":"ticketItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ticketPatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/ticket-links/{token}":{"get":{"tags":["tickets"],"summary":"Resolve a manager-alert link to its organisation and ticket","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TicketLinksToken","security":[{"session":[]}],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"response":"ticketLink"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys":{"get":{"tags":["setup"],"summary":"Surveys","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Create a survey from a template (version 1; status `live` publishes it, `draft` keeps it as a working copy)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveys","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyCreate","response":"surveyItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}":{"get":{"tags":["setup"],"summary":"A survey with its published definition","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveysSurveyId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyDetail"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/versions":{"get":{"tags":["setup"],"summary":"Survey versions, newest first (status `draft`, `published` or `retired`)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveysSurveyIdVersions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyVersionList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/versions/{version}":{"get":{"tags":["setup"],"summary":"One survey version with its definition","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveysSurveyIdVersionsVersion","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"version","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyVersionDetail"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/draft":{"put":{"tags":["setup"],"summary":"Save the working copy (409 SURVEY_STALE, 422 SURVEY_INVALID)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSurveysSurveyIdDraft","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyDraftSave","response":"surveyDraftSaved"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyDraftSave"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"Discard the working copy (the only hard delete of a version)","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdSurveysSurveyIdDraft","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/access":{"get":{"tags":["setup"],"summary":"SV-24: whether the survey asks for a password or a human check","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveysSurveyIdAccess","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyAccess"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"SV-24: set or remove the password and the human check (stored hashed)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSurveysSurveyIdAccess","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyAccessUpdate","response":"surveyAccess"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyAccessUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/interview":{"get":{"tags":["setup"],"summary":"SV-11: the interview guide the thank-you page offers as a follow-up interview (null: off)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveysSurveyIdInterview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyInterview"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"SV-11: set the follow-up interview guide, or null to turn it off","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSurveysSurveyIdInterview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyInterviewUpdate","response":"surveyInterview"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyInterviewUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/invite-tests":{"get":{"tags":["setup"],"summary":"SV-09: the survey's invitation A/B tests, the approved WhatsApp invitation templates per kind and whether SMS / e-mail text is live","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveysSurveyIdInviteTests","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"inviteTestList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"SV-09: an invitation test in set-up (2 to 4 variants; WhatsApp variants name approved templates only; 422 TEMPLATE_NOT_ALLOWED)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveysSurveyIdInviteTests","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"inviteTestInput","response":"inviteTest"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts inviteTestInput"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/invite-tests/{testId}":{"put":{"tags":["setup"],"summary":"SV-09: change an invitation test in set-up (409 TEST_NOT_DRAFT once started)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSurveysSurveyIdInviteTestsTestId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"testId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"inviteTestInput","response":"inviteTest"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts inviteTestInput"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/invite-tests/{testId}/start":{"post":{"tags":["setup"],"summary":"SV-09: start the test (one running per survey and kind; 422 TEMPLATE_NOT_APPROVED)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveysSurveyIdInviteTestsTestIdStart","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"testId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"inviteTest"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/invite-tests/{testId}/stop":{"post":{"tags":["setup"],"summary":"SV-09: stop a running test (new invitations get the standard wording again)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveysSurveyIdInviteTestsTestIdStop","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"testId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"inviteTest"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/invite-tests/{testId}/results":{"get":{"tags":["setup"],"summary":"SV-09: sent, delivered, opened, started, completed and reply rate per variant, with a two-proportion z-test read (not enough data under the minimum)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveysSurveyIdInviteTestsTestIdResults","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"testId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"inviteTestResults"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-glossary":{"get":{"tags":["setup"],"summary":"SV-05: the organisation's translation glossary (English and Arabic terms, a note, keep as it is)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveyGlossary","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyGlossaryList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"SV-05: add a glossary term (409 DUPLICATE_TERM or GLOSSARY_FULL)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveyGlossary","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyGlossaryCreate","response":"surveyGlossaryTerm"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyGlossaryCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-glossary/{termId}":{"patch":{"tags":["setup"],"summary":"SV-05: change a glossary term (409 DUPLICATE_TERM)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdSurveyGlossaryTermId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"termId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyGlossaryPatch","response":"surveyGlossaryTerm"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyGlossaryPatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"SV-05: remove a glossary term","description":"Permission: `surveys.write`.","operationId":"deleteV1TenantsTenantIdSurveyGlossaryTermId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"termId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/publish":{"post":{"tags":["setup"],"summary":"Publish the working copy as the next immutable version","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveysSurveyIdPublish","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyPublish","response":"surveyPublishResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyPublish"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/versions/{version}/restore":{"post":{"tags":["setup"],"summary":"Copy an earlier version into the working copy (rollback)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveysSurveyIdVersionsVersionRestore","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"version","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyRestore","response":"surveyDraftSaved"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyRestore"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/duplicate":{"post":{"tags":["setup"],"summary":"Copy a survey into a new survey that is not published","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveysSurveyIdDuplicate","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyDuplicate","response":"surveyItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyDuplicate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/contacts":{"get":{"tags":["setup"],"summary":"Contacts (cursor paged, q searches name, phone, email)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdContacts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"contactQuery","response":"contactList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Add one contact by hand (saves only, sends nothing; matches by phone, else email; consent pending, or no as a staff-given opt-out)","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdContacts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"contactCreateRequest","response":"contactCreateResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts contactCreateRequest"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/contacts/import":{"post":{"tags":["setup"],"summary":"Import contacts from a CSV (dryRun true by default: check and count only; matches by phone, else email; can add opt-outs, never clears one or sets consent)","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdContactsImport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"contactImportRequest","response":"contactImportResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts contactImportRequest"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/responses/import":{"post":{"tags":["responses"],"summary":"Import past answers from another tool into one published survey (dryRun true by default; owners and admins; imported responses open no tickets, send no alerts and do not count as new survey volume)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdResponsesImport","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"responseImportRequest","response":"responseImportResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts responseImportRequest"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/integrations":{"get":{"tags":["setup"],"summary":"Integrations: our products and this organisation's connectors","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdIntegrations","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"integrationList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/integrations/{source}":{"put":{"tags":["setup"],"summary":"Connect or change Telyzer, Telvory Desk or OmniBrand","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdIntegrationsSource","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}}],"x-sayvara-contract":{"body":"integrationUpsert","response":"integrationItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts integrationUpsert"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"Disconnect a product","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdIntegrationsSource","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/integrations/{source}/inbound-secret":{"post":{"tags":["setup"],"summary":"Make a new signing secret for the connection's own URL (shown once; the previous one keeps working for 24 hours)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdIntegrationsSourceInboundSecret","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}}],"x-sayvara-contract":{"body":"integrationInboundSecretBody","response":"integrationInboundSecret"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts integrationInboundSecretBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/webhooks":{"get":{"tags":["setup"],"summary":"Outbound webhook endpoints (signed with HMAC-SHA256)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdWebhooks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"webhookList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Register an outbound webhook (https only; an IP address or private or internal host is refused with 400 VALIDATION_FAILED); the secret is shown once","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdWebhooks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"webhookCreate","response":"webhookCreated"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts webhookCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/webhooks/{webhookId}":{"delete":{"tags":["setup"],"summary":"Remove an outbound webhook","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdWebhooksWebhookId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhookId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/qr-codes":{"get":{"tags":["setup"],"summary":"Dynamic QR codes per branch, counter or employee (CH-05)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdQrCodes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"qrCodeQuery","response":"qrCodeList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Make a dynamic QR code for a branch, counter or employee","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdQrCodes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"qrCodeCreate","response":"qrCodeItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts qrCodeCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/qr-codes/{qrCodeId}":{"patch":{"tags":["setup"],"summary":"Retarget, rename, pause or archive a QR code without reprinting","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdQrCodesQrCodeId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"qrCodeId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"qrCodePatch","response":"qrCodeItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts qrCodePatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/qr-codes/{qrCodeId}/image":{"get":{"tags":["setup"],"summary":"The QR code as SVG or PNG (1x / 2x)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdQrCodesQrCodeIdImage","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"qrCodeId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"qrImageQuery"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-assignment/rules":{"get":{"tags":["tickets"],"summary":"Assignment rules per queue (org unit) the caller can see (CL-18)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketAssignmentRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"assignmentRuleList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["tickets"],"summary":"Round-robin or load-balanced rule for a queue (409 RULE_EXISTS)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTicketAssignmentRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"assignmentRuleCreate","response":"assignmentRuleItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts assignmentRuleCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-assignment/rules/{ruleId}":{"patch":{"tags":["tickets"],"summary":"Change a rule: mode, limit, people, on or off","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdTicketAssignmentRulesRuleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"assignmentRulePatch","response":"assignmentRuleItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts assignmentRulePatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["tickets"],"summary":"Remove a rule (new tickets of the queue go to the next rule up)","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdTicketAssignmentRulesRuleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-rules":{"get":{"tags":["tickets"],"summary":"Ticket rules on sentiment, keyword and theme, in the order they are checked (CL-03)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ticketRuleList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["tickets"],"summary":"New ticket rule: negative sentiment, words or phrases, or chosen themes (409 RULE_LIMIT)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTicketRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ticketRuleCreate","response":"ticketRuleItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ticketRuleCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-rules/{ruleId}":{"patch":{"tags":["tickets"],"summary":"Change a ticket rule: name, words, themes, survey, priority, on or off","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdTicketRulesRuleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ticketRulePatch","response":"ticketRuleItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ticketRulePatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["tickets"],"summary":"Remove a ticket rule (tickets it opened stay)","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdTicketRulesRuleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/alert-destinations":{"get":{"tags":["tickets"],"summary":"Slack and Microsoft Teams alert destinations (incoming webhooks); the webhook URL is never returned","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAlertDestinations","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"alertDestinationList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["tickets"],"summary":"Add a Slack incoming webhook or Teams Workflows / incoming webhook URL; saved only after it took a test message (422 WEBHOOK_REJECTED)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdAlertDestinations","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"alertDestinationCreate","response":"alertDestinationItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts alertDestinationCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/alert-destinations/{destinationId}/test":{"post":{"tags":["tickets"],"summary":"Post a test message to an alert destination","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdAlertDestinationsDestinationIdTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"destinationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"alertDestinationTestBody","response":"alertDestinationTestResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts alertDestinationTestBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/alert-destinations/{destinationId}":{"delete":{"tags":["tickets"],"summary":"Remove an alert destination (its webhook URL leaves the vault)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdAlertDestinationsDestinationId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"destinationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-assignment/assignees":{"get":{"tags":["tickets"],"summary":"People a ticket (ticketId) or part (orgUnitId) can go to: active members who work tickets, never suspended (B1.4)","description":"Permission: `tickets.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketAssignmentAssignees","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"assigneeQuery","response":"assigneeList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-assignment/availability":{"get":{"tags":["tickets"],"summary":"Away status and open tickets (owners and admins: everyone; others: themselves)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketAssignmentAvailability","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"memberAvailabilityList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-assignment/availability/{membershipId}":{"put":{"tags":["tickets"],"summary":"Set away status (me, or anyone with policy.manage)","description":"Permission: `tickets.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdTicketAssignmentAvailabilityMembershipId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"membershipId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"availabilityPut","response":"memberAvailability"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts availabilityPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sla":{"get":{"tags":["tickets"],"summary":"Working-day calendars, targets and escalation ladders you can see, with the built-in defaults","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSla","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"slaSettings"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sla/calendars/{unit}":{"put":{"tags":["tickets"],"summary":"Set the calendar of the organisation (org) or a unit: weekdays, hours, Ramadan hours, holidays","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSlaCalendarsUnit","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"unit","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"slaCalendarPut","response":"slaCalendarItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts slaCalendarPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["tickets"],"summary":"Remove a calendar (the one above, or the Saudi standard, applies again)","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdSlaCalendarsUnit","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"unit","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sla/targets":{"put":{"tags":["tickets"],"summary":"Replace the first-response and resolution targets (working minutes or working days) per priority and unit","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSlaTargets","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"slaTargetsPut"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts slaTargetsPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sla/escalation":{"put":{"tags":["tickets"],"summary":"Replace the escalation ladder of the organisation or a unit","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSlaEscalation","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"escalationLadderPut"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts escalationLadderPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sla/alerts":{"get":{"tags":["tickets"],"summary":"The SLA escalation alert switches (WhatsApp and email) and the WhatsApp daily cap","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSlaAlerts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"slaAlertSettings"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["tickets"],"summary":"Turn SLA escalation alerts by WhatsApp or by email on or off","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSlaAlerts","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"slaAlertSettingsPut","response":"slaAlertSettings"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts slaAlertSettingsPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/sla/preview":{"get":{"tags":["tickets"],"summary":"The deadlines and escalation times a ticket opened at a given time would get","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSlaPreview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"slaPreviewQuery","response":"slaPreview"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/{ticketId}/conversation":{"get":{"tags":["tickets"],"summary":"Notes, replies and the customer messages of a ticket, and which channels can be used now","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketsTicketIdConversation","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ticketConversation"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/{ticketId}/notes":{"post":{"tags":["tickets"],"summary":"Add an internal note (never sent to the customer)","description":"Permission: `tickets.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTicketsTicketIdNotes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ticketNoteCreate","response":"conversationEntry"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ticketNoteCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/{ticketId}/replies":{"post":{"tags":["tickets"],"summary":"Reply to the customer on WhatsApp (free text inside the 24-hour window, else the ticket_reply_v1 template with a link once it is live) or SMS (200 with the same reply when requestKey was used before; 409 WHATSAPP_WINDOW_CLOSED, NO_WHATSAPP_SENDER, CONTACT_OPTED_OUT, NO_CONTACT_PHONE, TICKET_CLOSED; 403 REPLIES_OFF)","description":"Permission: `tickets.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTicketsTicketIdReplies","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ticketReplyCreate","response":"conversationEntry"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ticketReplyCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-frequency":{"get":{"tags":["setup"],"summary":"Survey dependency rules (CL-06): no survey of one type within N days after another, and the contact window","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveyFrequency","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyFrequencySettings"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"Replace the survey dependency rules (403 ORG_WIDE_ONLY for a branch-scoped admin)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSurveyFrequency","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyFrequencyPut","response":"surveyFrequencySettings"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyFrequencyPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/send-survey/options":{"get":{"tags":["setup"],"summary":"Send survey: channels switched on, your daily allowance and the approved message per kind in EN and AR","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSendSurveyOptions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sendSurveyOptions"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/send-survey/recipient-status":{"get":{"tags":["setup"],"summary":"Before sending: would this contact, phone (either spelling) or e-mail be refused as opted out on the channel? Only {blocked}; a recipient outside your scope answers not blocked (404 SURVEY_NOT_LIVE, 409 CHANNEL_OFF as the send; 429 SEND_STATUS_RATE_LIMITED)","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSendSurveyRecipientStatus","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"sendSurveyRecipientStatusQuery","response":"sendSurveyRecipientStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/send-survey":{"post":{"tags":["setup"],"summary":"Send one survey to a contact, phone or e-mail through the invitation pipeline (404 SURVEY_NOT_LIVE, 409 OPTED_OUT, CHANNEL_OFF, 422 NO_ADDRESS, ORG_UNIT_REQUIRED, 429 SEND_LIMIT_REACHED)","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSendSurvey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"sendSurveyRequest","response":"sendSurveyAccepted"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sendSurveyRequest"}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/send-survey/call":{"post":{"tags":["setup"],"summary":"Book an automated phone call (IVR) that asks one survey on the keypad, now or at a time on the next calling day (404 SURVEY_NOT_LIVE, 409 VOICE_CALL_OFF, CALL_REFUSED, OPTED_OUT, 422 NO_ADDRESS, 429 SEND_LIMIT_REACHED, 503 VOICE_CALL_OFF)","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSendSurveyCall","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"sendSurveyCallRequest","response":"sendSurveyCallAccepted"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sendSurveyCallRequest"}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/send-survey/test-call/options":{"get":{"tags":["setup"],"summary":"Test phone call (DEMO-FIX, flag voice.test_call_button): whether it is on, the last four digits of your verified mobile and the test calls left to the organisation this hour (flag off: on false, none left)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSendSurveyTestCallOptions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sendTestCallOptions"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/send-survey/test-call":{"post":{"tags":["setup"],"summary":"Place one test phone call now to your verified mobile, a phone or a contact, with the person's consent confirmed; not counted in your daily allowance (404 NOT_FOUND when the flag is off, SURVEY_NOT_LIVE; 409 VOICE_CALL_OFF, CALL_REFUSED, OPTED_OUT; 422 CONSENT_REQUIRED, NO_VERIFIED_PHONE, NO_ADDRESS, ORG_UNIT_REQUIRED; 429 TEST_CALL_LIMIT_REACHED; 503 VOICE_CALL_OFF)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSendSurveyTestCall","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"sendTestCallRequest","response":"sendTestCallAccepted"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts sendTestCallRequest"}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/send-survey/{invitationId}":{"get":{"tags":["setup"],"summary":"Where one sent survey stands: queued, sent, delivered, read, answered, failed or skipped (with the reason)","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSendSurveyInvitationId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"invitationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"sendSurveyStatus"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/{ticketId}/subcases":{"get":{"tags":["tickets"],"summary":"The parts of a ticket (the ticket must be visible)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketsTicketIdSubcases","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"subcaseList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["tickets"],"summary":"Split off a part for a team (200 with the same part when requestKey was used before; 409 SUBCASE_LIMIT)","description":"Permission: `tickets.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTicketsTicketIdSubcases","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"subcaseCreate","response":"subcaseItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts subcaseCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-subcases":{"get":{"tags":["tickets"],"summary":"The parts your teams can see (open, closed or all; mine)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketSubcases","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"subcaseQuery","response":"subcasePage"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-subcases/{subcaseId}":{"get":{"tags":["tickets"],"summary":"One part and its timeline","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketSubcasesSubcaseId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subcaseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"subcaseDetail"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["tickets"],"summary":"Change a part: status, person, note (cancel: whoever sees the whole ticket)","description":"Permission: `tickets.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdTicketSubcasesSubcaseId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subcaseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"subcasePatch","response":"subcaseItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts subcasePatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/qr-links/{code}":{"get":{"tags":["surveys-public"],"summary":"Resolve a scanned QR code to a signed survey link (404 unknown, 410 closed)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1QrLinksCode","security":[],"parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"qrLinkResolution"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/qr-links/{code}/flood":{"post":{"tags":["surveys-public"],"summary":"CH-05: the survey Worker reports unusual scan volume on a code, once per minute window (signed; 401, 404)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1QrLinksCodeFlood","security":[{"signature":[]}],"parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"qrFloodReport"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts qrFloodReport"}}}},"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}/files/{questionId}":{"post":{"tags":["surveys-public"],"summary":"SV-04: upload one photo for a photo question (JPEG/PNG/WebP, 5 MB; 404 off, 408 too slow, 413, 415, 429)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SurveyLinksTokenFilesQuestionId","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}},{"name":"questionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyFileUploaded"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/images":{"post":{"tags":["setup"],"summary":"SV-19: upload one picture for a picture-choice option (PNG/JPEG/WebP by its bytes, 2 MB; 404, 408 too slow, 409 archived, 413, 415, 429)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveysSurveyIdImages","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyImageUploaded"},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/images/{imageId}":{"get":{"tags":["setup"],"summary":"SV-19: a picture of the survey for the builder preview (the image bytes; also one only the working copy names)","description":"Permission: `feedback.read`.","operationId":"getV1TenantsTenantIdSurveysSurveyIdImagesImageId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"imageId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-images/{tenantId}/{surveyId}/{imageId}":{"get":{"tags":["surveys-public"],"summary":"SV-19: a picture a published survey names, for survey pages (the image bytes, cached a year; 404 for any other)","operationId":"getV1SurveyImagesTenantIdSurveyIdImageId","security":[],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"imageId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/responses/{responseId}/files/{fileId}":{"get":{"tags":["responses"],"summary":"SV-04: a short-lived link to a photo of a response (scoped)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdResponsesResponseIdFilesFileId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"responseId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"fileId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"responseFileLink"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}":{"get":{"tags":["surveys-public"],"summary":"Resolve a signed survey link (404 invalid, 410 expired, 423 SURVEY_LOCKED: send x-survey-unlock)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1SurveyLinksToken","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"response":"surveyLinkResolution"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}/unlock":{"post":{"tags":["surveys-public"],"summary":"SV-24: unlock a protected survey with its password and / or the human check (401, 400, 429)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SurveyLinksTokenUnlock","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"body":"surveyUnlockRequest","response":"surveyUnlockResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyUnlockRequest"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}/otp/request":{"post":{"tags":["surveys-public"],"summary":"SV-24: send a one-time code by WhatsApp or SMS for a protected survey link (never echoes the number; 400, 404, 429, 503)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SurveyLinksTokenOtpRequest","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"body":"surveyOtpRequest","response":"surveyOtpRequested"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyOtpRequest"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}/otp/verify":{"post":{"tags":["surveys-public"],"summary":"SV-24: check a one-time code; a right one gives the pass the unlock needs (401 wrong, 410 expired or used, 429 locked)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SurveyLinksTokenOtpVerify","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"body":"surveyOtpVerify","response":"surveyOtpVerified"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyOtpVerify"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/replies/{token}":{"get":{"tags":["surveys-public"],"summary":"CL-02: the reply a signed reply token names, for the /m/<token> page of the ticket_reply_v1 template (410 REPLY_LINK_EXPIRED for expired, unknown or closed; 429)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1PublicRepliesToken","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"response":"replyPageView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/responses":{"post":{"tags":["surveys-public"],"summary":"Save a web survey answer (upsert by responseId; 409 RESPONSE_EXISTS / RESPONSE_COMPLETED)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1Responses","security":[],"x-sayvara-contract":{"body":"surveyResponseSubmission","response":"surveyResponseAccepted"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyResponseSubmission"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai/settings":{"get":{"tags":["ai"],"summary":"AI route mode, allowed models, BYO key status and the read-only residency rule","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAiSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"aiSettingsView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["ai"],"summary":"Choose the AI route and allowed models (409 AI_RESIDENCY_REFUSED, AI_ROUTE_NOT_AVAILABLE)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdAiSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"aiSettingsPut","response":"aiSettingsView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts aiSettingsPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai/byo-key":{"put":{"tags":["ai"],"summary":"Put or replace your own AI key (stored in the tenant vault, never returned)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdAiByoKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"aiByoKeyPut","response":"aiSettingsView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts aiByoKeyPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["ai"],"summary":"Remove your own AI key (the BYO route switches AI off)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"deleteV1TenantsTenantIdAiByoKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"aiSettingsView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai/controls":{"get":{"tags":["ai"],"summary":"AI monthly call cap, staff message register, voice-note retention, this month's AI calls and the 80 / 100 % notice","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdAiControls","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"aiControlsView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["ai"],"summary":"Set the AI monthly call cap (null = plan allowance), message registers and voice-note retention","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdAiControls","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"aiControlsPut","response":"aiControlsView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts aiControlsPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-sync/diffs":{"get":{"tags":["setup"],"summary":"Org-tree changes proposed by HR / directory sync (IN-06)","description":"Permission: `org.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdOrgSyncDiffs","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"orgSyncDiffQuery","response":"orgSyncDiffList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-sync/diffs/{diffId}":{"get":{"tags":["setup"],"summary":"One proposed org-tree change set for review","description":"Permission: `org.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdOrgSyncDiffsDiffId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"diffId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"orgSyncDiffDetail"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-sync/diffs/{diffId}/approve":{"post":{"tags":["setup"],"summary":"Approve and apply a proposed org-tree change set through the org directory (422 ORG_SYNC_APPLY_REFUSED; 503 ORG_SYNC_WRITER_UNAVAILABLE: the result is not known, the proposal stays pending and approving again finishes it with the same payload)","description":"Permission: `org.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdOrgSyncDiffsDiffIdApprove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"diffId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"orgSyncApprove","response":"orgSyncDiffDetail"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts orgSyncApprove"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-sync/diffs/{diffId}/reject":{"post":{"tags":["setup"],"summary":"Reject a proposed org-tree change set","description":"Permission: `org.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdOrgSyncDiffsDiffIdReject","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"diffId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"orgSyncReject","response":"orgSyncDiffDetail"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts orgSyncReject"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-sync/settings":{"get":{"tags":["setup"],"summary":"Org sync settings per source","description":"Permission: `org.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdOrgSyncSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"orgSyncSettingsView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"Change the org sync settings of one source","description":"Permission: `org.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdOrgSyncSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"orgSyncSettingsPut","response":"orgSyncSettingsView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts orgSyncSettingsPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-sync/csv-files/{kind}":{"post":{"tags":["setup"],"summary":"Upload the CSV source's units or members file (text/csv, UTF-8, 5 MB; checked like the HR CSV connector reads it, 400 ORG_SYNC_CSV_INVALID with details.line); the answer's file ref goes to the CSV Sync now. 404 while org_sync.hr_connect or the plan is off","description":"Permission: `integrations.manage`.","operationId":"postV1TenantsTenantIdOrgSyncCsvFilesKind","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kind","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/org-sync/csv-files/{fileId}":{"delete":{"tags":["setup"],"summary":"Remove an uploaded CSV source file once its Sync now has answered (only org-sync CSV files; files older than a day are removed by themselves). 404 while org_sync.hr_connect or the plan is off","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdOrgSyncCsvFilesFileId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"fileId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/crm-connections":{"get":{"tags":["setup"],"summary":"Connected CRMs (Salesforce, Dynamics 365) with field mapping and language","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCrmConnections","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"crmConnectionList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Connect a CRM; the client secret goes to the tenant vault (422 CRM_AUTH_FAILED, 409 ALREADY_CONNECTED)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCrmConnections","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"crmConnectionCreate","response":"crmConnectionItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts crmConnectionCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/crm-connections/{connectionId}":{"patch":{"tags":["setup"],"summary":"Field mapping, language, reference field, pause (400 CRM_FIELD_INVALID, CRM_FIELD_TWICE)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdCrmConnectionsConnectionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"crmConnectionPatch","response":"crmConnectionItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts crmConnectionPatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"Disconnect a CRM and remove its secret from the vault","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdCrmConnectionsConnectionId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/crm-connections/{connectionId}/test":{"post":{"tags":["setup"],"summary":"Test the connection now (the result is a code, never CRM text)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCrmConnectionsConnectionIdTest","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"crmTestRun","response":"crmTestResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts crmTestRun"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/crm-connections/{connectionId}/inbound-map":{"get":{"tags":["setup"],"summary":"Inbound field mapping (IN-20): CRM fields to Sayvara contact, response and ticket fields","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdCrmConnectionsConnectionIdInboundMap","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"crmInboundMap"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"Save the inbound field mapping (each Sayvara field once; ticket fields from cases only)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdCrmConnectionsConnectionIdInboundMap","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"crmInboundMap","response":"crmInboundMap"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts crmInboundMap"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/crm-connections/{connectionId}/inbound-map/test-run":{"post":{"tags":["setup"],"summary":"Test run on the newest CRM records: what Sayvara would make of them; stores nothing","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdCrmConnectionsConnectionIdInboundMapTestRun","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"crmInboundTestRun","response":"crmInboundTestResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts crmInboundTestRun"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/{ticketId}/crm-cases":{"get":{"tags":["tickets"],"summary":"The CRM cases this follow-up opened, their sync state and the status the CRM holds now","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketsTicketIdCrmCases","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"crmCaseLinkList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/{ticketId}/crm-cases/{linkId}/retry":{"post":{"tags":["tickets"],"summary":"Send a failed CRM case again with a fresh count of tries: pending without a case, linked with one (409 CRM_CASE_NOT_FAILED, CRM_CONNECTION_PAUSED)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTicketsTicketIdCrmCasesLinkIdRetry","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"linkId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"crmCaseRetryBody","response":"crmCaseLinkItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts crmCaseRetryBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/contacts/{contactId}/crm-account":{"get":{"tags":["setup"],"summary":"The CRM account behind this contact, per CRM connection that knows the contact (empty when none)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdContactsContactIdCrmAccount","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"contactId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"crmContactAccountList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}/follow-up":{"post":{"tags":["surveys-public"],"summary":"SV-02: one AI follow-up question after an answer, in the respondent's dialect ({ ask: false } when none; 403 SURVEY_LOCKED)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SurveyLinksTokenFollowUp","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"body":"surveyFollowUpRequest","response":"surveyFollowUpResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyFollowUpRequest"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}/interview":{"post":{"tags":["surveys-public"],"summary":"SV-11: start the follow-up interview of the response the start proof names; sets the interview cookie ({ state: off } when none)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SurveyLinksTokenInterview","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"body":"surveyInterviewStartRequest","response":"surveyInterviewPageResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyInterviewStartRequest"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}/interview/{id}/reply":{"post":{"tags":["surveys-public"],"summary":"SV-11: one reply in the interview (idempotent by replyId; 403 INTERVIEW_SESSION without this browser's cookie)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SurveyLinksTokenInterviewIdReply","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyInterviewReplyRequest","response":"surveyInterviewPageResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyInterviewReplyRequest"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}/interview/{id}/finish":{"post":{"tags":["surveys-public"],"summary":"SV-11: end the interview now (403 INTERVIEW_SESSION without this browser's cookie)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SurveyLinksTokenInterviewIdFinish","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyInterviewPageResult"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/survey-links/{token}/skips":{"post":{"tags":["surveys-public"],"summary":"SV-13: which remaining optional questions this respondent skips, when the survey turns on adaptive shortening ({ skip: [] } when none; 403 SURVEY_LOCKED, 429)","description":"Authorised by the signed survey link token only (no session). Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1SurveyLinksTokenSkips","security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","description":"Opaque token (survey link or ticket link)"}}],"x-sayvara-contract":{"body":"surveySkipsRequest","response":"surveySkipsResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveySkipsRequest"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/kiosks":{"get":{"tags":["setup"],"summary":"Kiosk tablets per branch, with their sync status (CH-06)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdKiosks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"kioskQuery","response":"kioskList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Make a kiosk for a branch and a survey","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdKiosks","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"kioskCreate","response":"kioskItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts kioskCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/kiosks/{kioskId}":{"patch":{"tags":["setup"],"summary":"Rename, move or retarget a kiosk, or change its mode","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdKiosksKioskId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kioskId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"kioskPatch","response":"kioskItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts kioskPatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/kiosks/{kioskId}/pairing":{"post":{"tags":["setup"],"summary":"A one-time code to pair a tablet (15 minutes)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdKiosksKioskIdPairing","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kioskId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"kioskActionBody","response":"kioskPairing"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts kioskActionBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/kiosks/{kioskId}/revoke":{"post":{"tags":["setup"],"summary":"Revoke a kiosk: its tablet stops at once","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdKiosksKioskIdRevoke","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"kioskId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"kioskActionBody","response":"kioskRevoked"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts kioskActionBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/kiosk/pair":{"post":{"tags":["surveys-public"],"summary":"Pair a kiosk tablet with its one-time code","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1KioskPair","security":[],"x-sayvara-contract":{"body":"kioskPairRequest","response":"kioskPairResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts kioskPairRequest"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/kiosk/config":{"get":{"tags":["surveys-public"],"summary":"The paired tablet reads its kiosk and survey (Bearer kiosk token)","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1KioskConfig","security":[],"x-sayvara-contract":{"query":"kioskConfigQuery","response":"kioskRuntime"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/kiosk/responses":{"post":{"tags":["surveys-public"],"summary":"The paired tablet uploads finished answers, idempotent per response id","description":"Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1KioskResponses","security":[],"x-sayvara-contract":{"body":"kioskBatch","response":"kioskBatchResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts kioskBatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/today":{"get":{"tags":["tickets"],"summary":"My branch today: scores vs last week, my open tickets by SLA, latest unhappy answers","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdFrontlineToday","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"frontlineToday"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/push":{"get":{"tags":["tickets"],"summary":"Web Push: available, VAPID public key, organisation switch, this device subscribed","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdFrontlinePush","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"frontlinePushQuery","response":"frontlinePush"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/push/subscriptions":{"post":{"tags":["tickets"],"summary":"Turn alerts on for this device (409 PUSH_NOT_CONFIGURED, PUSH_OFF, PUSH_DEVICE_TAKEN)","description":"Permission: `tickets.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdFrontlinePushSubscriptions","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"pushSubscriptionCreate","response":"pushSubscriptionResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts pushSubscriptionCreate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/push/subscriptions/remove":{"post":{"tags":["tickets"],"summary":"Turn alerts off for this device (also on sign-out)","description":"Permission: `tickets.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdFrontlinePushSubscriptionsRemove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"pushSubscriptionRemove","response":"pushSubscriptionResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts pushSubscriptionRemove"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/frontline/push/settings":{"put":{"tags":["tickets"],"summary":"The organisation's push alerts switch (owners and admins)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdFrontlinePushSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"frontlinePushSettings","response":"frontlinePush"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts frontlinePushSettings"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-look":{"get":{"tags":["setup"],"summary":"SV-06 / SV-07: the survey page look (theme, accent, accessible mode by default, logo as a data URL)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveyLook","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyLook"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"SV-06 / SV-07: set the theme, accent, accessible mode by default and the logo alt text","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSurveyLook","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyLookUpdate","response":"surveyLook"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyLookUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-look/logo":{"put":{"tags":["setup"],"summary":"SV-07: upload the logo (PNG, JPEG or WebP up to 48 KB, checked from its bytes; 400 LOGO_TYPE, 413 LOGO_TOO_LARGE)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSurveyLookLogo","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyLogoUpload","response":"surveyLook"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyLogoUpload"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"SV-07: remove the logo","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"deleteV1TenantsTenantIdSurveyLookLogo","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyLook"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/approval":{"get":{"tags":["setup"],"summary":"CL-07: whether publishing needs a second person, and the newest publish request of the open working copy","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveysSurveyIdApproval","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"surveyApproval"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-approvals":{"get":{"tags":["setup"],"summary":"CL-07: the organisation's survey publish requests across surveys: pending (waiting for a checker, or approved with the publish unfinished; oldest first) or the newest 50 decided; the decision stays in the builder","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveyApprovals","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"surveyApprovalQueueQuery","response":"surveyApprovalQueue"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/approval/approve":{"post":{"tags":["setup"],"summary":"CL-07: approve a pending publish request and publish the working copy (403 SURVEY_SELF_APPROVAL for the maker, 409 SURVEY_APPROVAL_DECIDED)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveysSurveyIdApprovalApprove","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyApprovalApprove","response":"surveyPublishResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyApprovalApprove"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/approval/reject":{"post":{"tags":["setup"],"summary":"CL-07: reject a pending publish request with a reason; the working copy is not published (403 SURVEY_SELF_APPROVAL for the maker)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveysSurveyIdApprovalReject","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyApprovalReject","response":"surveyApproval"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyApprovalReject"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/surveys/{surveyId}/status":{"put":{"tags":["setup"],"summary":"SV-01: pause or resume a survey; personal links sent before the pause stay open 72 h (409 SURVEY_STATUS_INVALID to pause a survey that is not live or resume one that is not paused)","description":"Permission: `surveys.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSurveysSurveyIdStatus","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"surveyStatusUpdate","response":"surveyItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts surveyStatusUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voice-runs":{"get":{"tags":["setup"],"summary":"CH-18: voice-survey runs the member can see, newest first","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdVoiceRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"voiceRunList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"CH-18: make a voice-survey run for a contact list or a saved audience, paced by per-minute and daily caps inside the call window; opted-out and do-not-call contacts are never called (422 VOICE_RUN_SURVEY_NOT_LIVE, VOICE_RUN_NOT_VOICE, VOICE_RUN_NOT_VOICE_FIT, VOICE_RUN_CONTACT_UNKNOWN, VOICE_RUN_EMPTY, VOICE_RUN_TOO_LARGE, VOICE_RUN_TIME_ZONE, VOICE_RUN_NO_CALL_TIME; 503 VOICE_SUPPRESSION_UNAVAILABLE; audited)","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdVoiceRuns","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"voiceRunCreate","response":"voiceRun"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts voiceRunCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voice-runs/{runId}":{"get":{"tags":["setup"],"summary":"CH-18: one voice-survey run with its progress","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdVoiceRunsRunId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"voiceRun"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/voice-runs/{runId}/cancel":{"post":{"tags":["setup"],"summary":"CH-18: cancel an active voice-survey run (empty body); its open contacts end canceled and are not called again (audited)","description":"Permission: `contacts.write`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdVoiceRunsRunIdCancel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"emptyBody","response":"voiceRun"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts emptyBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/phone-surveys/settings":{"get":{"tags":["setup"],"summary":"CH-10: the phone-survey switch (off by default) and its settings, with the console gate, the caller number, the price per started minute and the plan, read only","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPhoneSurveysSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"phoneSurveySettingsView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["setup"],"summary":"CH-10: save the phone-survey settings; turning the switch on also needs billing.manage, the plan and confirmPrice (403 PHONE_SURVEYS_BILLING_REQUIRED, ENTITLEMENT_REQUIRED, ORG_WIDE_ONLY; 409 PHONE_SURVEYS_PRICE_UNAVAILABLE; 409 PHONE_SURVEYS_PRICE_CHANGED; 422 PHONE_SURVEYS_PRICE_NOT_CONFIRMED, PHONE_WINDOW_OUTSIDE_SEND_HOURS, PHONE_WINDOW_IN_QUIET_HOURS, PHONE_FALLBACK_BEFORE_REMINDER); turning it off always works, also for a branch-scoped member, and cancels the queued calls (audited)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdPhoneSurveysSettings","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"phoneSurveySettingsPut","response":"phoneSurveySettingsView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts phoneSurveySettingsPut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/phone-call-rules":{"get":{"tags":["setup"],"summary":"CH-10: the call rules (\"call N hours or days after this event\")","description":"Permission: `tenant.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdPhoneCallRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"phoneCallRuleList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"CH-10: add a call rule (409 PHONE_CALL_RULE_DUPLICATE, PHONE_CALL_RULE_LIMIT; 422 PHONE_CALL_RULE_SURVEY; audited)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdPhoneCallRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"phoneCallRuleInput","response":"phoneCallRule"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts phoneCallRuleInput"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/phone-call-rules/{ruleId}":{"put":{"tags":["setup"],"summary":"CH-10: replace a call rule (audited)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdPhoneCallRulesRuleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"phoneCallRuleInput","response":"phoneCallRule"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts phoneCallRuleInput"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"CH-10: delete a call rule (audited)","description":"Permission: `policy.manage`.","operationId":"deleteV1TenantsTenantIdPhoneCallRulesRuleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-rules/contact-centre":{"get":{"tags":["setup"],"summary":"Genesys row 16: the contact-centre survey rules in the order the trigger tries them (ordinary rules by position, then the connection defaults, then the tenant default), each with the earlier rule that shadows it","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdSurveyRulesContactCentre","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ccSurveyRuleList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Genesys row 16: add a rule by connection, media, message type, direction, queue and wrap-up code, with its survey and channel mode (same channel from the tenant's own sender only, the organisation's order, or fixed channels) and fallback; a new ordinary rule goes last (400 VALIDATION_FAILED, UNKNOWN_SURVEY, SURVEY_NOT_LIVE, UNKNOWN_CONNECTION, UNKNOWN_UNIT; 403 OUT_OF_SCOPE; 409 RULE_LIMIT, DEFAULT_EXISTS; audited)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveyRulesContactCentre","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ccSurveyRuleCreate","response":"ccSurveyRuleItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ccSurveyRuleCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-rules/contact-centre/{ruleId}":{"put":{"tags":["setup"],"summary":"Genesys row 16: replace a rule, with the version it was read at (409 STALE_VERSION when someone changed it since; a default stays a default; audited as updated, enabled or disabled)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdSurveyRulesContactCentreRuleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ccSurveyRuleUpdate","response":"ccSurveyRuleItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ccSurveyRuleUpdate"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"Genesys row 16: remove a rule (409 DEFAULT_IN_USE for a default while ordinary rules exist; audited)","description":"Permission: `integrations.manage`.","operationId":"deleteV1TenantsTenantIdSurveyRulesContactCentreRuleId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ruleId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-rules/contact-centre/order":{"post":{"tags":["setup"],"summary":"Genesys row 16: put every ordinary rule the member sees in a new order, in one transaction (positions 10, 20, ...; 400 ORDER_MISMATCH; audited)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveyRulesContactCentreOrder","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ccSurveyRuleOrder","response":"ccSurveyRuleList"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ccSurveyRuleOrder"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/survey-rules/contact-centre/dry-run":{"post":{"tags":["setup"],"summary":"Genesys row 16: which rule, survey and channels a sample conversation would get, with every rule tried and why it did not fit; sends nothing and does not call Genesys (opt-out and quiet hours apply at send time)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdSurveyRulesContactCentreDryRun","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"ccSurveyRuleDryRun","response":"ccSurveyRuleDryRunResult"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts ccSurveyRuleDryRun"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/sms-sender-ids":{"get":{"tags":["setup"],"summary":"The organisation's own SMS sender ID requests and their review status","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdChannelsSmsSenderIds","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"smsSenderRequestList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Ask for an own alphanumeric SMS sender ID (Sayvara staff review and register it)","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsSmsSenderIds","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"smsSenderRequestCreateBody","response":"smsSenderRequest"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts smsSenderRequestCreateBody"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/sms-sender-ids/{requestId}/cancel":{"post":{"tags":["setup"],"summary":"Cancel a request that is waiting or in review","description":"Permission: `tenant.update`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdChannelsSmsSenderIdsRequestIdCancel","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"requestId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"emptyBody","response":"smsSenderRequest"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts emptyBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai/sentiment-backfill":{"get":{"tags":["ai"],"summary":"AI-01: progress of the analysis of older written answers (analysed, waiting, given up)","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdAiSentimentBackfill","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["ai"],"summary":"AI-01: start the analysis of older written answers once (202 queued, 200 already started; 409 AI_OFF, AI_GOVERNANCE_REFUSED; 403 ENTITLEMENT_REQUIRED)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdAiSentimentBackfill","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/hooks/native/{source}/{connectionId}":{"post":{"tags":["hooks"],"summary":"Telvory Desk ticket.solved and csat.received (one URL per connection), Telyzer call.completed / call.missed or OmniBrand message.received (comment or mention; a WhatsApp, Instagram or Messenger dm goes to the unified inbox) in the product's own envelope and signature (X-Telvory-Signature, X-Telyzer-Signature, x-omnibrand-signature-v2) for one connection; mapped to ticket.closed / call.ended / social.mention. Off per tenant until switched on","operationId":"postV1HooksNativeSourceConnectionId","security":[{"signature":[]}],"parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string","enum":["telyzer","telvory-desk","omnibrand"]}},{"name":"connectionId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai/themes":{"get":{"tags":["ai"],"summary":"AI-01: the theme catalogue, its tag counts (last 30 days) and the confidence threshold","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdAiThemes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["ai"],"summary":"AI-01: add a theme (409 AI_THEME_EXISTS, AI_THEME_LIMIT)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdAiThemes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai/themes/{key}":{"patch":{"tags":["ai"],"summary":"AI-01: rename, describe, archive or restore a theme (409 AI_THEME_LIMIT)","description":"Permission: `tenant.update`.","operationId":"patchV1TenantsTenantIdAiThemesKey","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai/themes/threshold":{"put":{"tags":["ai"],"summary":"AI-01: set the confidence threshold (0.30 to 0.95)","description":"Permission: `tenant.update`.","operationId":"putV1TenantsTenantIdAiThemesThreshold","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ai/themes/review":{"get":{"tags":["ai"],"summary":"AI-01: low-confidence tags waiting for a person (not counted)","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdAiThemesReview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["ai"],"summary":"AI-01: confirm or reject one waiting tag (404 when already reviewed)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdAiThemesReview","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-closing":{"get":{"tags":["tickets"],"summary":"Closure codes (the shared root-cause list and the resolution codes, English and Arabic) and what is required before a ticket is resolved or closed","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketClosing","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ticketClosingSettings"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-closing/rules":{"put":{"tags":["tickets"],"summary":"Set what is required before close: root cause, resolution code, a note of a minimum length (owners and admins)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdTicketClosingRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"closeRules","response":"ticketClosingSettings"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts closeRules"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-closing/codes":{"post":{"tags":["tickets"],"summary":"Add a root-cause or resolution code (409 CLOSURE_CODE_TAKEN, 422 CLOSURE_CODE_LIMIT)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTicketClosingCodes","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"closureCodeCreate","response":"closureCodeItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts closureCodeCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/ticket-closing/codes/{codeId}":{"patch":{"tags":["tickets"],"summary":"Rename, re-sort, re-categorise or switch a closure code on or off (codes are never deleted)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"patchV1TenantsTenantIdTicketClosingCodesCodeId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"codeId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"closureCodePatch","response":"closureCodeItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts closureCodePatch"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/whatsapp/twilio-number":{"get":{"tags":["setup"],"summary":"Own WhatsApp number through a Twilio subaccount: availability (flag, plan) and the newest request with its status","description":"Permission: `tenant.update`.","operationId":"getV1TenantsTenantIdChannelsWhatsappTwilioNumber","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["setup"],"summary":"Request an own WhatsApp number (flag channels.twilio_subaccount, plan key byo_whatsapp; one open request; audited)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdChannelsWhatsappTwilioNumber","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"phoneE164":{"type":"string","pattern":"^\\+[1-9][0-9]{6,14}$"},"displayName":{"type":"string","minLength":1,"maxLength":100},"wabaId":{"type":"string","pattern":"^[0-9]{5,32}$"}},"required":["phoneE164","displayName"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["setup"],"summary":"Cancel the open request; the worker then closes the subaccount (audited)","description":"Permission: `tenant.update`.","operationId":"deleteV1TenantsTenantIdChannelsWhatsappTwilioNumber","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/whatsapp/twilio-number/verification":{"post":{"tags":["setup"],"summary":"Submit the verification code Meta sent to the number while the request waits for it (409 TWILIO_NUMBER_NOT_WAITING; 6 per hour; audited without the code)","description":"Permission: `tenant.update`.","operationId":"postV1TenantsTenantIdChannelsWhatsappTwilioNumberVerification","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"code":{"type":"string","pattern":"^[0-9]{4,10}$"}},"required":["code"],"additionalProperties":false}}}},"responses":{"202":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/itsm-rules":{"get":{"tags":["integrations"],"summary":"Help-desk ticket rules (ServiceNow, Zendesk): the score at or under which a follow-up ticket becomes a ticket there and its priority, whether each help desk is connected, whether Sayvara can open tickets (live), and counts per state for the last 30 days (plan: group_integrations)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdItsmRules","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"itsmRuleList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/itsm-rules/{provider}":{"put":{"tags":["integrations"],"summary":"Save the rule of one help desk (servicenow or zendesk); switching it on or raising its score sends tickets opened from now on, once the help desk is connected and the push is live (plan: group_integrations)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdItsmRulesProvider","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"itsmRulePut","response":"itsmRuleItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts itsmRulePut"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/{ticketId}/external-refs":{"get":{"tags":["tickets"],"summary":"The ticket's help-desk tickets: state, number and link, or why it is not open (an ItsmError code)","description":"Permission: `feedback.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdTicketsTicketIdExternalRefs","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ticketExternalRefList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/tickets/{ticketId}/external-refs/{provider}/retry":{"post":{"tags":["tickets"],"summary":"Queue a refused help-desk ticket of this ticket again (status failed only; attempts start from zero), for example after the help desk's credentials were fixed; 409 ITSM_REF_NOT_FAILED otherwise (plan: group_integrations)","description":"Permission: `integrations.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdTicketsTicketIdExternalRefsProviderRetry","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"ticketId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"ticketExternalRefList"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/sla":{"get":{"tags":["insights"],"summary":"SLA report: on-time resolution and first response, breaches by unit and by priority (the priority before any SLA raise), escalation steps (reopen alerts left out), for the tickets opened in the period (Riyadh days; default the last 30) in the caller's units (403 ENTITLEMENT_REQUIRED without the plan key)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportsSla","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"slaRecoveryQuery","response":"slaReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/recovery":{"get":{"tags":["insights"],"summary":"Recovery report: detractors followed up, fixes the customer accepted and recovered customers, overall and by unit, for the tickets opened in the period (403 ENTITLEMENT_REQUIRED without the plan key)","description":"Permission: `dashboards.read`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportsRecovery","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"query":"slaRecoveryQuery","response":"recoveryReport"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/sla-recovery/exports":{"post":{"tags":["insights"],"summary":"Download the SLA or recovery report: CSV ready at once (201), or PDF printed by the worker (202, then poll); 429 RATE_LIMITED past the hourly export limit; 503 REPORT_PDF_UNAVAILABLE when no worker can print","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"postV1TenantsTenantIdReportsSlaRecoveryExports","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"slaRecoveryExportCreate","response":"slaRecoveryExportItem"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts slaRecoveryExportCreate"}}}},"responses":{"201":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/reports/sla-recovery/exports/{exportId}":{"get":{"tags":["insights"],"summary":"One SLA or recovery report download of the caller, with a fresh signed link (7 days at most) once ready","description":"Permission: `feedback.export`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdReportsSlaRecoveryExportsExportId","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"exportId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"slaRecoveryExportItem"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tenants/{tenantId}/channels/sms-gateway/region":{"get":{"tags":["messaging"],"summary":"Data region of the own SMS connection, its region delivery-report path and the regions (404 while the tenant flag messaging.connection_regions is off)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"getV1TenantsTenantIdChannelsSmsGatewayRegion","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"response":"connectionRegionView"},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["messaging"],"summary":"Set the own SMS connection's data region; null = the organisation's region; only null or this API's (home) region, else 409 REGION_NOT_HOME; 409 REGION_NOT_ACTIVE (404 while the tenant flag messaging.connection_regions is off)","description":"Permission: `policy.manage`. Schemas: `@sayvara/contracts` (see `x-sayvara-contract`).","operationId":"putV1TenantsTenantIdChannelsSmsGatewayRegion","security":[{"session":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"x-sayvara-contract":{"body":"connectionRegionBody","response":"connectionRegionView"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"@sayvara/contracts connectionRegionBody"}}}},"responses":{"200":{"description":"Success"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"session":{"type":"apiKey","in":"cookie","name":"__Host-sv_session"},"signature":{"type":"apiKey","in":"header","name":"Sayvara-Signature","description":"t=<unix>,v1=<hex HMAC-SHA256 of \"t.body\">"},"twilioSignature":{"type":"apiKey","in":"header","name":"X-Twilio-Signature","description":"Twilio request signature (HMAC-SHA1 of URL + sorted form fields)"},"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"sv_<12 hex prefix>_<43 char secret>","description":"Organisation API key: `Authorization: Bearer sv_...`. 401 INVALID_API_KEY when missing, wrong, revoked or expired; 403 API_KEY_SCOPE when the key lacks the route scope; 429 RATE_LIMITED with Retry-After (120 requests per key per minute by default). When the edge in front of the API answers 429 RATE_LIMITED itself, its Retry-After and RateLimit-Reset give the window length (60 s): an upper bound on the wait, not the exact reset."},"scimToken":{"type":"http","scheme":"bearer","bearerFormat":"svscim_<43 chars>","description":"SCIM token from Settings > Single sign-on > Provisioning: `Authorization: Bearer svscim_...`, bodies `application/scim+json`. Shown once at creation; 401 with a SCIM error body when missing, wrong or revoked."},"oauthClient":{"type":"oauth2","description":"OAuth 2.0 client credentials from Settings > API access: exchange the client id and secret at POST /v1/oauth/token, then send `Authorization: Bearer <access token>` (a JWT, 5 to 60 minutes). Revoking the client, or rotating its secret without grace, stops its tokens at once; the IP allow-list is checked on every call.","flows":{"clientCredentials":{"tokenUrl":"/v1/oauth/token","scopes":{}}}}},"schemas":{"Error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}}}}}}