{"openapi":"3.1.0","info":{"title":"Agend Gateway API","description":"Centralised API gateway for accessing Agend platform services: one base URL, one unified API key, every Agend product surface.\n\n## Authentication\n\nEvery `/v1/**` endpoint is authenticated. Most use an Agend API key; mobile bootstrap and organisation-scoped member routes use the bearer flow described below. There are no anonymous endpoints.\n\n- **API key (where declared)**: send via the `X-API-Key` header. Keys are scoped; each operation declares the scopes it needs in its security requirements, named `<app>.<resource>.<verb>` (for example `crm.contacts.browse`). Issue least-privilege keys from your account settings.\n- **User bearer token (where declared)**: operations that act on behalf of a specific user (for example `/v1/crm/me/*`) additionally require a Supabase user JWT sent as `Authorization: Bearer <jwt>`. The bearer layers on top of the API key and never replaces it. The token's user must be a member of the API key's account, and the bearer is the sole proof of identity: these operations never accept a user id parameter.\n- **Mobile access**: `/v1/mobile/me/*` bootstrap operations require only the ordinary Supabase bearer. Organisation-scoped mobile operations require that bearer plus the short-lived mobile JWT in `X-Agend-Mobile-Access`; the selected account and fixed member-safe scopes come only from that independently verified token.\n- **Two-mode operations**: some write operations accept either flow. Bearer-attended calls use the elevated `<app>.<resource>.manage` scope plus a bearer JWT identifying the acting member; unattended server-to-server calls use the granular `.create` / `.update` / `.delete` scope with no bearer. Each mode appears as an alternative security requirement on the operation.\n\n- **Key environment**: an `ag_test_` key authenticates only against a sandbox account and an `ag_live_` key only against a production account. A key used against the other environment is refused with `401` and the error code `KEY_ENVIRONMENT_MISMATCH`. `GET /v1/health` reports the key's account environment as `environment` (`production` or `sandbox`). Existing `ag_test_` keys on production accounts keep working for 30 days after the release that introduced this rule, as recorded in the changelog, and are then refused.\n\nAuthentication failures return `401` (missing or invalid key or bearer, or a key whose environment does not match its account) or `403` (key lacks a required scope, or the bearer user is not a member of the key's account).\n\n## Standards\n\n- **Response envelope**: success responses are `{ \"success\": true, \"data\": ... }` with an optional `meta` object; errors are `{ \"success\": false, \"error\": { \"code\", \"message\", \"details\" } }`.\n- **Pagination**: list endpoints accept `page` and `limit` query parameters and report `meta.pagination` with `page`, `limit`, `total`, `total_pages`, `has_next`, and `has_prev`.\n- **Casing**: query parameters are camelCase (`sortBy`, `createdAfter`); request and response body fields are snake_case (`display_name`, `start_at`).\n- **Rate limiting**: authenticated API-key requests use the operation's explicit limit first, then the API key's configured per-minute limit, then the 60 requests-per-minute default. Mobile sessions are limited per user. Read the effective limit from `X-RateLimit-Limit` rather than assuming the default. Every response reports the window via the `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` (epoch seconds) headers; exceeding the limit returns `429` with a `Retry-After` header.\n- **Conditional requests**: every `GET` success response carries a strong `ETag`. Send it back as `If-None-Match` to receive `304 Not Modified` with an empty body when the resource is unchanged — auth, scopes, and rate limits still apply to `304`s, and they count toward billable usage. Authenticated responses default to `Cache-Control: private, no-cache` (never shared-cacheable).\n- **Environment**: responses carry `X-Agend-Environment` (`production` or `sandbox`), naming the environment of the authenticated account, once the account is authenticated by an API key, portal bearer or mobile token. That includes error responses that follow authentication. It is exposed to cross-origin browser callers through `Access-Control-Expose-Headers`. It is absent when authentication fails before the account is known, on the Supabase-bearer mobile bootstrap routes, and when the environment cannot be read.\n\n## Webhooks\n\nAgend delivers outbound webhooks as signed HTTPS POSTs to URLs you register. Your server receives these requests, so no Agend security scheme applies to them; instead, you verify authenticity from the signature header.\n\n- **Subscribe** via `POST /v1/webhooks/subscriptions` (scope `webhooks.subscriptions.manage`), listing the namespaced event ids you want. The available events are documented under each product's Webhooks tag. The signing secret is returned exactly once, at creation or rotation.\n- **Verify** every delivery using the `X-Agend-Signature` header: Stripe-style `t=<unix>,v1=<hex>` where `v1 = HMAC-SHA256(\"<t>.<rawBody>\", secret)`. Reject deliveries whose timestamp is older than 5 minutes to close the replay window.\n- **Deduplicate** using `X-Agend-Event-Id`, which is stable across retries.\n- **Filter by environment** using the envelope's `environment` field (`production` or `sandbox`), so a staging listener can discard production events and a production listener can discard sandbox events.\n- **Acknowledge** with any 2xx response. Failed deliveries are retried with exponential backoff up to 5 attempts (`X-Agend-Delivery-Attempt`), and a subscription is automatically disabled after 10 consecutive failed deliveries.\n\n## Changelog\n\n### v0.55.0 (2026-11-17)\n\n- **Deprecated** `GET /v1/jobs/me`: operation newly marked deprecated (sunset Mon, 01 Mar 2027 00:00:00 GMT)\n- **Deprecated** `POST /v1/jobs/me`: operation newly marked deprecated (sunset Mon, 01 Mar 2027 00:00:00 GMT)\n- **Deprecated** `PATCH /v1/jobs/me/{id}`: operation newly marked deprecated (sunset Mon, 01 Mar 2027 00:00:00 GMT)\n- **Deprecated** `POST /v1/jobs/me/{id}/withdraw`: operation newly marked deprecated (sunset Mon, 01 Mar 2027 00:00:00 GMT)\n- **Deprecated** `POST /v1/jobs/me/{id}/close`: operation newly marked deprecated (sunset Mon, 01 Mar 2027 00:00:00 GMT)\n- **Added** `POST /v1/crm/memberships/purchase, POST /v1/crm/me/memberships, POST /v1/crm/me/orders/{id}/pay, POST /v1/crm/me/team/seats/purchase, POST /v1/crm/me/team/seats and POST /v1/events/registrations/pay`: Sandbox membership and order checkout refusals return the named 403 instead of an unexpected 500.. A sandbox without a permitted primary gateway now returns 403 SANDBOX_PAYMENT_NOT_PERMITTED before a new payment session is created, with the same message as cart checkout. An active Stripe sandbox gateway with test keys or an active eWay sandbox gateway remains permitted. Non-sandbox accounts are unaffected. Cart and CRM checkout 403 descriptions now name both permitted gateways. Hand-authored: the classifier does not report description changes or this error-mapping correction.\n- **Added** `GET /v1/jobs/submissions`: new operation\n- **Added** `GET /v1/jobs/submissions/{id}`: new operation\n- **Added** `GET /v1/jobs/credits`: new operation\n- **Added** `POST /v1/jobs/submissions`: new operation\n- **Added** `PATCH /v1/jobs/submissions/{id}`: new operation\n- **Added** `POST /v1/jobs/submissions/{id}/withdraw`: new operation\n- **Added** `POST /v1/jobs/submissions/{id}/close`: new operation\n\n### v0.54.0 (2026-11-16)\n\n- **Added** `POST /v1/crm/orders`: A membership line's beneficiary_contact_id names its holder; an invalid one is ignored. A membership line's metadata key beneficiary_contact_id now names the contact who holds the membership, and the order's contact pays for it. It is stored like any other line metadata and is honoured when the order is paid: the named contact's membership on the tier is created, or extended when they already hold it. A value that names no contact in the organisation, or that sits on a company tier line, is ignored: the order's contact holds the membership as before, nothing fails after payment, and the line's metadata records beneficiary_ignored_reason as not_in_organisation or company_tier. The request and response schemas are unchanged, and no field, status or enum member is removed. Hand-authored: the classifier does not report a change in what a metadata key does.\n\n### v0.53.0 (2026-11-13)\n\n- **Breaking** `webhooks/crm.membership.reinstated`: order_id is nullable on crm.membership.reinstated; a staff renewal of a membership in grace carries previous_status grace and order_id null.. Contract change approved as an exception to the additive-payload rule (Sam Glew's ruling on #7070, 10 November 2026, https://github.com/Agend-Systems/agend-dashboard/issues/7070#issuecomment-6758619567). crm.membership.reinstated now also fires when staff renew a membership in grace, not only when a payment returns it to active. That event has no order, so its order_id is now null where it was always a uuid string, and a subscriber that types it as a non-null string must accept null. A payment reinstatement still carries the order. The crm.membership.updated event no longer fires for a staff renewal from grace, so a subscriber that relied on it for that case must also listen for crm.membership.reinstated. Only a membership on a tier that removes access during grace can be in grace, and none is until a tier is set to remove. Hand-authored: the classifier does not report a payload field that became nullable, because webhooks are not under paths.\n- **Breaking** `POST /v1/crm/tiers and PATCH /v1/crm/tiers/{id}`: A tier with grace_access remove and grace_period_days at or above its billing period length is refused with 400.. A tier whose grace_access is remove and whose billing_period is monthly, quarterly, annually or biannually is now refused with a 400 INVALID_INPUT unless grace_period_days is shorter than the billing period: at most 29 days for monthly, 89 quarterly, 364 annually and 729 biannually (Sam Glew's ruling on #7070, 10 November 2026). On PATCH the check runs against the stored values the request leaves in place, so lengthening only grace_period_days, shortening only billing_period or switching only grace_access to remove can each be refused. A tier already over the limit keeps its values until one of the three fields changes. The grace_access field is in this same unreleased window, so no released version accepted remove as a working setting. keep tiers, lifetime tiers and tiers with no billing period have no limit. Hand-authored: the classifier sees only description changes on these operations.\n- **Added** `GET /v1/crm/contacts`: Contact status can be deceased; the list filter accepts it.. A contact status can now be deceased, set when staff close a member's record as deceased in CRM. The list status filter accepts deceased, and any contact read can return it. The status field on responses is an open string, so no response schema changes. PATCH /v1/crm/contacts/{id} and POST /v1/crm/contacts/bulk still refuse deceased: closing a record also cancels its memberships and removes its login, which only the CRM action does. Hand-authored: the classifier does not report a documented value on an open string.\n- **Added** `GET /v1/cms/content/{slug}`: Container and row slots can hold a nested access-gate entry.. A restricted block inside a block.container or block.row slot is now withheld from a viewer outside its audience, and its place in the slot is taken by a nested access-gate entry: { id, type: \"access-gate\", access }. It has no position and no payload key, and adjacent nested gates with the same requirement collapse into one. A restricted container is returned as one top-level access-gate with nothing beneath it. A client iterating a container's children must handle an entry of type access-gate; rendering nothing for it matches the top-level behaviour. Visible nested entries never carry a policy key. The container child shape is documented as the CmsNestedAccessGate and CmsContainerChild components, while the fragment payload stays an opaque object. Hand-authored: the classifier does not report a new schema reachable only through an opaque payload.\n- **Added** `GET /v1/jobs/me`: new operation\n- **Added** `POST /v1/jobs/me`: new operation\n- **Added** `PATCH /v1/jobs/me/{id}`: new operation\n- **Added** `POST /v1/jobs/me/{id}/withdraw`: new operation\n- **Added** `POST /v1/jobs/me/{id}/close`: new operation\n\n### v0.52.0 (2026-11-10)\n\n- **Breaking** `POST /v1/crm/contacts/bulk`: [request] body.operations[]<oneOf[1]>.data.status: enum member \"inactive\" removed. The database has never stored this contact status (crm_contacts_status_check allows active, pending, lapsed, expired and cancelled), so a request carrying it always failed with a server error. It is now refused with a 400 validation error, and pending, expired and cancelled are accepted. No integrator could have depended on the removed value. Classified breaking; ships as a 0.x minor. GitHub issue #7277.\n- **Breaking** `POST /v1/crm/contacts/bulk`: [request] body.operations[]<oneOf[1]>.data.status: enum member \"archived\" removed. The database has never stored this contact status (crm_contacts_status_check allows active, pending, lapsed, expired and cancelled), so a request carrying it always failed with a server error. It is now refused with a 400 validation error, and pending, expired and cancelled are accepted. No integrator could have depended on the removed value. Classified breaking; ships as a 0.x minor. GitHub issue #7277.\n- **Breaking** `POST /v1/crm/contacts/bulk`: [request] body.operations[]<oneOf[1]>.data.status: enum member \"banned\" removed. The database has never stored this contact status (crm_contacts_status_check allows active, pending, lapsed, expired and cancelled), so a request carrying it always failed with a server error. It is now refused with a 400 validation error, and pending, expired and cancelled are accepted. No integrator could have depended on the removed value. Classified breaking; ships as a 0.x minor. GitHub issue #7277.\n- **Breaking** `POST /v1/crm/contacts/bulk`: [request] body.operations[]<oneOf[1]>.data.status: enum member \"deceased\" removed. The database has never stored this contact status (crm_contacts_status_check allows active, pending, lapsed, expired and cancelled), so a request carrying it always failed with a server error. It is now refused with a 400 validation error, and pending, expired and cancelled are accepted. No integrator could have depended on the removed value. Classified breaking; ships as a 0.x minor. GitHub issue #7277.\n- **Breaking** `PATCH /v1/crm/contacts/{id}`: [request] body.status: enum member \"inactive\" removed. The database has never stored this contact status (crm_contacts_status_check allows active, pending, lapsed, expired and cancelled), so a request carrying it always failed with a server error. It is now refused with a 400 validation error, and pending, expired and cancelled are accepted. No integrator could have depended on the removed value. Classified breaking; ships as a 0.x minor. GitHub issue #7277.\n- **Breaking** `PATCH /v1/crm/contacts/{id}`: [request] body.status: enum member \"archived\" removed. The database has never stored this contact status (crm_contacts_status_check allows active, pending, lapsed, expired and cancelled), so a request carrying it always failed with a server error. It is now refused with a 400 validation error, and pending, expired and cancelled are accepted. No integrator could have depended on the removed value. Classified breaking; ships as a 0.x minor. GitHub issue #7277.\n- **Breaking** `PATCH /v1/crm/contacts/{id}`: [request] body.status: enum member \"banned\" removed. The database has never stored this contact status (crm_contacts_status_check allows active, pending, lapsed, expired and cancelled), so a request carrying it always failed with a server error. It is now refused with a 400 validation error, and pending, expired and cancelled are accepted. No integrator could have depended on the removed value. Classified breaking; ships as a 0.x minor. GitHub issue #7277.\n- **Breaking** `PATCH /v1/crm/contacts/{id}`: [request] body.status: enum member \"deceased\" removed. The database has never stored this contact status (crm_contacts_status_check allows active, pending, lapsed, expired and cancelled), so a request carrying it always failed with a server error. It is now refused with a 400 validation error, and pending, expired and cancelled are accepted. No integrator could have depended on the removed value. Classified breaking; ships as a 0.x minor. GitHub issue #7277.\n- **Added** `GET /v1/crm/tiers`: member_count counts active and grace memberships.. member_count, returned when includeMemberCounts is true, now counts memberships that are active or in grace, because a member in grace is a member. active_membership_count and non_active_membership_count on GET /v1/crm/tiers/{id} keep counting by exact status, so a membership in grace is non-active there. No row holds the grace status until a later release. Hand-authored: the classifier does not report a change in what a field counts.\n- **Added** `GET /v1/crm/memberships, GET /v1/crm/me/memberships and PATCH /v1/crm/memberships/{id}`: [200] body.data.status: documented value grace added; [body] status: grace refused. A membership status can now be grace, set by the platform for a membership on a tier that removes access during grace. A membership in grace has no access until it is paid or staff restore access, then it is active again. The status field was already an open string, so no schema changes; a client that trusts only active denies access to a member in grace, which is the intended effect. grace is refused as an administrative status on PATCH /v1/crm/memberships/{id}. No row holds the status until a later release. Hand-authored: the classifier does not report a documented value on an open string field.\n- **Added** `webhooks/crm.membership.grace_started`: Version 1 payload identifies membership_id, account_id, contact_id, tier_id, status, previous_status and grace_ends_on.. A new webhook, crm.membership.grace_started, will fire when an unpaid membership on a tier that removes access during grace moves from active to grace. It carries previous_status and grace_ends_on. crm.membership.reinstated and crm.membership.lapsed can now carry previous_status grace, and crm.membership.lapsed gains an optional previous_status, the status the membership held immediately before it lapsed. The event is registered now and fires from a later release. Hand-authored: the classifier does not report a payload field added to an existing webhook.\n- **Added** `POST /v1/crm/tiers, PATCH /v1/crm/tiers/{id}, GET /v1/crm/tiers and GET /v1/crm/tiers/{id}`: [200] body.data.grace_access: response field added; [body] grace_access: optional request field added. Membership tiers accept and return grace_access (keep, remove), which sets whether members keep access during the grace period. keep is the default and changes nothing for existing tiers. The setting has no effect on access until a later release introduces the grace membership status. Hand-authored: the classifier does not report these inline response-schema additions.\n- **Added** `GET /v1/jobs`: [query] includeRemote: added. includeRemote is a new optional query parameter, true or false (any other value is a 400 VALIDATION_ERROR), default false. With lat, lng and radius and includeRemote=true, the list also includes live remote jobs (location_type remote) whatever their coordinates, filtered by every other parameter. A job in both sets is listed once and keeps its distance_km; a remote job outside the radius has a null distance_km. With sortBy=distance, jobs with a distance come first, nearest first, then remote jobs without one, newest published first; featuredFirst still leads with sponsored and featured listings, each group in that order. Any other sort orders the combined list. total and pagination cover the combined list, which adds at most the 1000 newest remote jobs. Without a point the parameter is ignored. With false or absent, responses are unchanged. GitHub issue #7404. Hand-authored: the classifier reports no change.\n\n### v0.51.0 (2026-11-09)\n\n- **Added** `GET /v1/jobs`: [query] lat, lng, radius: added; sortBy gains distance; [200] body.data[].location_postcode, distance_km: response fields added. lat, lng and radius (kilometres, 1 to 1000) are new optional query parameters, sent all three or none: one or two alone is a 400 VALIDATION_ERROR. With all three, only jobs with stored coordinates within the radius are listed, and every item carries distance_km, rounded to one decimal place (null when no point was sent). sortBy gains the value distance, which lists nearest first and is a 400 unless lat, lng and radius are present; featuredFirst still puts sponsored and featured listings ahead of it. The location filter now also matches a job's postcode. Each listed job gains location_postcode and distance_km, both nullable. The list item schema is now named JobListItem in the OpenAPI document (it was the Job schema, which now also carries the single-job fields). GitHub issue #7253. Hand-authored: the classifier reports no change.\n- **Added** `GET /v1/jobs/{slugOrId}`: [200] body.data.location_postcode, reference_number, contact_name, contact_phone, distance_km: response fields added. A job gains location_postcode, reference_number, contact_name and contact_phone (each a string, or null when the employer left it empty) and distance_km, which is always null on a single job. The reference number and contact details are returned by this operation only, not by the list. GitHub issue #7253. Hand-authored: the classifier does not report these inline response-schema additions.\n- **Added** `POST /v1/workflows/upbeat/record-refreshes`: outcome enum gains requested; refresh runs asynchronously. The refresh now runs asynchronously, because the read of the Upbeat record must run from the workflows project, the only one Upbeat's IP allowlist admits. The operation still answers 200 with one { workflow_id, outcome } entry per matching workflow, but the outcome is now always the new value `requested`, added to the outcome enum. The outcomes run_requested, unchanged, not_in_feed, lookup_unconfirmed and lookup_failed stay in the enum and are recorded server side; this operation no longer returns them. No status, field or enum member is removed and the request body is unchanged. GitHub issue #7112. Hand-authored: the classifier reports no change.\n\nFull history: [`GET /v1/changelog`](/v1/changelog) returns every released block as `{ \"releases\": [{ \"version\", \"date\", \"api_path_version\", \"entries\" }] }`. No API key required.","version":"0.56.0","contact":{"name":"Agend Support","email":"support@agend.com.au","url":"https://api.agend.com.au/v1/docs"}},"servers":[{"url":"https://api.agend.com.au/","description":"Production"},{"url":"https://api.agend.info/","description":"Staging"}],"tags":[{"name":"System","description":"Health and status endpoints"},{"name":"Embed","description":"Embed session exchange: mints a single-use bootstrap token so a trusted host site can establish an authenticated iframe session."},{"name":"Atlas","description":"Knowledgebase source documents, collections, search and Ask Atlas"},{"name":"Auth","description":"Public auth gateway: sign in, register, refresh, logout, password recovery and change. Wraps Supabase Auth and enforces the caller is a contact of the API key account."},{"name":"Cart","description":"Shopping cart management and checkout initiation"},{"name":"CMS","description":"Multi-collection content store: list and detail by slug, with category/tag filters and full-text search"},{"name":"Directory","description":"Business directory listings, categories, search, and reviews"},{"name":"Contacts","description":"Tenant contact records: CRUD, full-text search, bulk operations, and team listings."},{"name":"Companies","description":"Organisation records linked to contacts."},{"name":"Deals","description":"Pipeline deals: CRUD, lifecycle mutations (close/move), per-deal activities, tasks, and bulk operations."},{"name":"Tasks","description":"Standalone CRM tasks. Tasks may be unattached or scoped to a contact or deal."},{"name":"Memberships","description":"Membership records attached to contacts: lifecycle, renewal, cancellation."},{"name":"Orders","description":"CRM orders: admin-issued pending invoices for members to pay, plus the bearer-attended pay-now flow."},{"name":"Tiers","description":"Membership tier definitions: pricing, billing cadence, benefits, app access."},{"name":"Signup Fields","description":"Public custom-field definitions an association marks for its membership signup form. Definitions only, never stored member values."},{"name":"Seats","description":"Corporate-membership seats. Listing, adding, removing, and updating role/status."},{"name":"Segments","description":"Audience segments and the contacts that match their filter criteria (read-only at v1.0)."},{"name":"Me","description":"Bearer-attended endpoints that operate on the caller's contact: profile, transactions, team, statements, CPD exports, colleagues, and the connected-profile cross-app aggregate."},{"name":"Configuration","description":"Read-only classifier surfaces used by the deals pipeline: stages and deal types."},{"name":"Analytics","description":"Aggregate pipeline statistics and dashboard summaries."},{"name":"Events","description":"Event discovery, ticket pricing, registration, and attendee management"},{"name":"Jobs","description":"Public job listings: list, detail by slug or UUID, search and filter"},{"name":"Webhooks: Jobs","description":"Outbound webhooks emitted when a member job submission is approved, rejected or withdrawn. Each carries the credit reference the connected site sent, so it can confirm or restore the member credit."},{"name":"LMS","description":"Courses, lessons, learning paths, enrollments, certificates, CPD, and webhooks"},{"name":"Loop","description":"Threads, bots, activity, notifications, and public-channel feeds"},{"name":"Sites","description":"Published site configuration for embedded widgets (Elementor): the account branding, feature flags, and public surface config a trusted host site reads to render."},{"name":"SSO","description":"Tenant SSO/SAML connection management: list, create, update, and delete identity-provider connections. The IdP certificate is returned masked."},{"name":"Workflows","description":"Workflow triggers fed by external systems: ask Agend to refresh one Upbeat record so its workflow runs without waiting for the next polling check."},{"name":"Agents","description":"Specialist-agent chat and intervention-proposal decisions. Gateway reverse-proxy to the dashboard-hosted agent runtime; scope-gated (agents.chat, agents.interventions.manage) plus a Supabase user bearer."},{"name":"Mobile Access","description":"Organisation discovery and short-lived mobile session bootstrap."},{"name":"Webhooks: Management","description":"Manage webhook subscriptions and inspect delivery history via the unified API key. See also the Webhooks: Events tag for the per-event delivery contracts."},{"name":"Webhooks: Events","description":"Outbound webhooks emitted by the events domain. Subscribers receive signed HTTPS POSTs with a stable envelope shape; see the WebhookEventEnvelope schema and the X-Agend-Signature header."},{"name":"Webhooks: LMS","description":"Outbound webhooks emitted by the LMS domain. Enrollment created and completed events."},{"name":"Webhooks: Loop","description":"Outbound webhooks emitted by the Loop domain. Thread replies and user mentions."},{"name":"Webhooks: CRM Orders","description":"Outbound webhooks emitted by the CRM orders domain. Order paid, failed, and refunded events."},{"name":"Webhooks: CRM Billing","description":"Outbound webhooks emitted by the CRM billing domain. Membership created, updated, cancelled, renewed, reinstated and lapsed events, the corporate membership seats affected event, corporate seat added, updated and removed events, and the subscription and order dispute events."},{"name":"Webhooks: CRM Entitlements","description":"Outbound webhooks emitted when a member direct entitlement grants change, or when the entitlement catalogue changes what members hold. Entitlement granted and revoked events, and the account-wide benefit changed event."},{"name":"Webhooks: CRM Contacts","description":"Outbound webhooks emitted when the contact facts a segment is computed from change. A contact attributes changed event per contact, and an account-wide bulk updated event for a bulk action that changes more than 100 contacts."},{"name":"Webhooks: CRM Segments","description":"Outbound webhooks emitted when a segment definition changes. The account-wide segment updated event."}],"security":[{"apiKey":[]}],"x-tagGroups":[{"name":"System","tags":["System"]},{"name":"Atlas","tags":["Atlas"]},{"name":"Auth","tags":["Auth"]},{"name":"Cart","tags":["Cart"]},{"name":"CMS","tags":["CMS"]},{"name":"Directory","tags":["Directory"]},{"name":"CRM","tags":["Contacts","Companies","Deals","Tasks","Memberships","Orders","Tiers","Signup Fields","Seats","Segments","Entitlements","Me","Configuration","Analytics","Webhooks: CRM Orders","Webhooks: CRM Billing","Webhooks: CRM Entitlements","Webhooks: CRM Contacts","Webhooks: CRM Segments"]},{"name":"Events","tags":["Events","Webhooks: Events"]},{"name":"Jobs","tags":["Jobs","Webhooks: Jobs"]},{"name":"LMS","tags":["LMS","Webhooks: LMS"]},{"name":"Loop","tags":["Loop","Webhooks: Loop"]},{"name":"Sites","tags":["Sites"]},{"name":"SSO","tags":["SSO"]},{"name":"Workflows","tags":["Workflows"]},{"name":"Agents","tags":["Agents"]},{"name":"Mobile Access","tags":["Mobile Access"]},{"name":"Webhooks","tags":["Webhooks: Management"]}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key for authentication. Obtain from your account settings."},"userBearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Supabase user bearer token. Required on routes that resolve the caller's user identity. Send as `Authorization: Bearer <jwt>` alongside the `X-API-Key` header."},"supabaseBearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Ordinary Supabase access token. Send as Authorization: Bearer <jwt>. Bootstrap routes require no API key."},"mobileSession":{"type":"apiKey","in":"header","name":"X-Agend-Mobile-Access","description":"Organisation-scoped mobile session JWT. Must be supplied alongside the ordinary Supabase bearer."}},"headers":{"X-Request-ID":{"description":"Unique request identifier for tracing","schema":{"type":"string"}},"X-RateLimit-Limit":{"description":"Request ceiling for the current window (requests per minute)","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Number of requests remaining in the current window","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (epoch seconds) when the rate limit window resets","schema":{"type":"integer"}},"X-Agend-Environment":{"description":"Environment of the authenticated account that produced the response: `production` or `sandbox`. Present once the account is authenticated by an API key, portal bearer or mobile token, including error responses that follow authentication. Absent when authentication fails before the account is known, on the Supabase-bearer mobile bootstrap routes, and when the environment cannot be read. Exposed to cross-origin browser callers via `Access-Control-Expose-Headers`.","schema":{"type":"string","enum":["production","sandbox"]}},"ETag":{"description":"Strong entity validator for the response body (GET only). Send it back as `If-None-Match` to receive 304 Not Modified when the resource is unchanged (SPEC-API-20260703 US-2.4).","schema":{"type":"string"}},"X-Agend-Event":{"description":"Namespaced event id, e.g. events.event.published","schema":{"type":"string"}},"X-Agend-Event-Id":{"description":"UUID of the delivery row. Stable across retries; use for consumer-side dedupe.","schema":{"type":"string","format":"uuid"}},"X-Agend-Signature":{"description":"Stripe-style timestamped HMAC-SHA256: `t=<unix>,v1=<hex>`. v1 = HMAC-SHA256(`${t}.${body}`, secret). Reject deliveries whose timestamp is older than 5 minutes to close the replay window.","schema":{"type":"string","example":"t=1700000000,v1=abc123..."}},"X-Agend-Delivery-Attempt":{"description":"Attempt counter starting at 1. Increments on each retry; max 5 before the delivery is marked failed.","schema":{"type":"integer","minimum":1}}},"schemas":{"PaginationMeta":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"total_pages":{"type":"integer"},"has_next":{"type":"boolean"},"has_prev":{"type":"boolean"}},"required":["page","limit","total","total_pages","has_next","has_prev"]},"ApiError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"]}},"required":["success","error"]},"WebhookEventEnvelope":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"type":{"type":"string","description":"Namespaced event id, e.g. events.event.published.","example":"events.event.published"},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"data":{"type":"object","additionalProperties":{},"description":"Event-specific payload. See the per-event schemas in this document."}},"required":["id","type","schema_version","sequence","account_id","environment","created_at","data"]},"WebhookSubscriberAck":{"type":"object","properties":{"received":{"type":"boolean"}}},"AtlasDocument":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"lineage_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["source_doc"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","in_review","published","archived"]},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"revision_type":{"type":["string","null"],"enum":["major","minor"]},"change_reason":{"type":["string","null"]},"supersedes":{"type":["string","null"],"format":"uuid"},"superseded_by":{"type":["string","null"],"format":"uuid"},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"review_interval_months":{"type":["integer","null"],"exclusiveMinimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"published_at":{"type":["string","null"],"format":"date-time"},"archived_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","lineage_id","kind","title","description","status","version_major","version_minor","revision_type","change_reason","supersedes","superseded_by","space_id","category","tags","topics","review_interval_months","last_reviewed_date","created_at","updated_at","published_at","archived_at"],"additionalProperties":false},"AtlasDocumentListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"lineage_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["source_doc"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","in_review","published","archived"]},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"revision_type":{"type":["string","null"],"enum":["major","minor"]},"change_reason":{"type":["string","null"]},"supersedes":{"type":["string","null"],"format":"uuid"},"superseded_by":{"type":["string","null"],"format":"uuid"},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"review_interval_months":{"type":["integer","null"],"exclusiveMinimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"published_at":{"type":["string","null"],"format":"date-time"},"archived_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","lineage_id","kind","title","description","status","version_major","version_minor","revision_type","change_reason","supersedes","superseded_by","space_id","category","tags","topics","review_interval_months","last_reviewed_date","created_at","updated_at","published_at","archived_at"],"additionalProperties":false}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"AtlasDocumentResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"lineage_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["source_doc"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","in_review","published","archived"]},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"revision_type":{"type":["string","null"],"enum":["major","minor"]},"change_reason":{"type":["string","null"]},"supersedes":{"type":["string","null"],"format":"uuid"},"superseded_by":{"type":["string","null"],"format":"uuid"},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"review_interval_months":{"type":["integer","null"],"exclusiveMinimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"published_at":{"type":["string","null"],"format":"date-time"},"archived_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","lineage_id","kind","title","description","status","version_major","version_minor","revision_type","change_reason","supersedes","superseded_by","space_id","category","tags","topics","review_interval_months","last_reviewed_date","created_at","updated_at","published_at","archived_at"],"additionalProperties":false}},"required":["success","data"]},"AtlasDocumentCreatedResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"lineage_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["source_doc"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","in_review","published","archived"]},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"revision_type":{"type":["string","null"],"enum":["major","minor"]},"change_reason":{"type":["string","null"]},"supersedes":{"type":["string","null"],"format":"uuid"},"superseded_by":{"type":["string","null"],"format":"uuid"},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"review_interval_months":{"type":["integer","null"],"exclusiveMinimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"published_at":{"type":["string","null"],"format":"date-time"},"archived_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","lineage_id","kind","title","description","status","version_major","version_minor","revision_type","change_reason","supersedes","superseded_by","space_id","category","tags","topics","review_interval_months","last_reviewed_date","created_at","updated_at","published_at","archived_at"],"additionalProperties":false}},"required":["success","data"]},"AtlasDocumentUpdatedResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"lineage_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["source_doc"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","in_review","published","archived"]},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"revision_type":{"type":["string","null"],"enum":["major","minor"]},"change_reason":{"type":["string","null"]},"supersedes":{"type":["string","null"],"format":"uuid"},"superseded_by":{"type":["string","null"],"format":"uuid"},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"review_interval_months":{"type":["integer","null"],"exclusiveMinimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"published_at":{"type":["string","null"],"format":"date-time"},"archived_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","lineage_id","kind","title","description","status","version_major","version_minor","revision_type","change_reason","supersedes","superseded_by","space_id","category","tags","topics","review_interval_months","last_reviewed_date","created_at","updated_at","published_at","archived_at"],"additionalProperties":false}},"required":["success","data"]},"AtlasCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"item_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["id","title","description","topics","item_count","created_at","updated_at"],"additionalProperties":false},"AtlasCollectionListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"item_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["id","title","description","topics","item_count","created_at","updated_at"],"additionalProperties":false}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"AtlasCollectionResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"item_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["id","title","description","topics","item_count","created_at","updated_at"],"additionalProperties":false}},"required":["success","data"]},"AtlasSearchHit":{"type":"object","properties":{"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"char_start":{"type":["integer","null"]},"char_end":{"type":["integer","null"]},"excerpt":{"type":"string"},"score":{"type":["number","null"]}},"required":["chunk_id","document_id","document_version_id","document_title","document_kind","version_major","version_minor","last_reviewed_date","section_id","page_number","char_start","char_end","excerpt","score"],"additionalProperties":false},"AtlasSearchResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"char_start":{"type":["integer","null"]},"char_end":{"type":["integer","null"]},"excerpt":{"type":"string"},"score":{"type":["number","null"]}},"required":["chunk_id","document_id","document_version_id","document_title","document_kind","version_major","version_minor","last_reviewed_date","section_id","page_number","char_start","char_end","excerpt","score"],"additionalProperties":false}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"AtlasAskResult":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["answer"]},"answer":{"type":"string"},"citations":{"type":"array","items":{"type":"object","properties":{"marker":{"type":"integer","exclusiveMinimum":0},"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"char_start":{"type":["integer","null"]},"char_end":{"type":["integer","null"]},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["marker","chunk_id","document_id","document_version_id","section_id","page_number","char_start","char_end","document_title","document_kind","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}},"confidence":{"type":"string","enum":["high","low"]},"disclaimer":{"type":"string"}},"required":["kind","answer","citations","confidence","disclaimer"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["refusal"]},"message":{"type":"string"},"disclaimer":{"type":"string"}},"required":["kind","message","disclaimer"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["not_entitled"]},"tier":{"type":"string","enum":["free","starter","professional","enterprise"]},"reason":{"type":"string","enum":["no_subscription","tier_insufficient","trial_expired","subscription_cancelled"]}},"required":["kind","tier","reason"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["degraded"]},"message":{"type":"string"},"search_results":{"type":"array","items":{"type":"object","properties":{"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"snippet":{"type":"string"}},"required":["chunk_id","document_id","document_version_id","document_title","document_kind","version_major","version_minor","section_id","page_number","snippet"],"additionalProperties":false}},"contact_path":{"type":["string","null"]}},"required":["kind","message","search_results","contact_path"],"additionalProperties":false}]},"AtlasAskResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["answer"]},"answer":{"type":"string"},"citations":{"type":"array","items":{"type":"object","properties":{"marker":{"type":"integer","exclusiveMinimum":0},"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"char_start":{"type":["integer","null"]},"char_end":{"type":["integer","null"]},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["marker","chunk_id","document_id","document_version_id","section_id","page_number","char_start","char_end","document_title","document_kind","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}},"confidence":{"type":"string","enum":["high","low"]},"disclaimer":{"type":"string"}},"required":["kind","answer","citations","confidence","disclaimer"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["refusal"]},"message":{"type":"string"},"disclaimer":{"type":"string"}},"required":["kind","message","disclaimer"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["not_entitled"]},"tier":{"type":"string","enum":["free","starter","professional","enterprise"]},"reason":{"type":"string","enum":["no_subscription","tier_insufficient","trial_expired","subscription_cancelled"]}},"required":["kind","tier","reason"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["degraded"]},"message":{"type":"string"},"search_results":{"type":"array","items":{"type":"object","properties":{"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"snippet":{"type":"string"}},"required":["chunk_id","document_id","document_version_id","document_title","document_kind","version_major","version_minor","section_id","page_number","snippet"],"additionalProperties":false}},"contact_path":{"type":["string","null"]}},"required":["kind","message","search_results","contact_path"],"additionalProperties":false}]}},"required":["success","data"]},"AtlasAskBudget":{"type":"object","properties":{"month_start":{"type":"string","format":"date"},"base_cap_tokens":{"type":"integer","minimum":0},"topup_tokens":{"type":"integer","minimum":0},"cap_tokens":{"type":"integer","minimum":0},"used_tokens":{"type":"integer","minimum":0},"remaining_tokens":{"type":"integer","minimum":0},"projected_month_end_tokens":{"type":"integer","minimum":0},"alert_thresholds_pct":{"type":"array","items":{"type":"integer","minimum":0,"maximum":100}},"crossed_thresholds_pct":{"type":"array","items":{"type":"integer","minimum":0,"maximum":100}},"exhausted":{"type":"boolean"}},"required":["month_start","base_cap_tokens","topup_tokens","cap_tokens","used_tokens","remaining_tokens","projected_month_end_tokens","alert_thresholds_pct","crossed_thresholds_pct","exhausted"],"additionalProperties":false},"AtlasAskBudgetResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"month_start":{"type":"string","format":"date"},"base_cap_tokens":{"type":"integer","minimum":0},"topup_tokens":{"type":"integer","minimum":0},"cap_tokens":{"type":"integer","minimum":0},"used_tokens":{"type":"integer","minimum":0},"remaining_tokens":{"type":"integer","minimum":0},"projected_month_end_tokens":{"type":"integer","minimum":0},"alert_thresholds_pct":{"type":"array","items":{"type":"integer","minimum":0,"maximum":100}},"crossed_thresholds_pct":{"type":"array","items":{"type":"integer","minimum":0,"maximum":100}},"exhausted":{"type":"boolean"}},"required":["month_start","base_cap_tokens","topup_tokens","cap_tokens","used_tokens","remaining_tokens","projected_month_end_tokens","alert_thresholds_pct","crossed_thresholds_pct","exhausted"],"additionalProperties":false}},"required":["success","data"]},"AtlasMemberCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"items":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"position":{"type":"integer","minimum":0}},"required":["page_id","title","position"],"additionalProperties":false}}},"required":["id","title","description","topics","items"],"additionalProperties":false},"AtlasMemberCollectionListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"items":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"position":{"type":"integer","minimum":0}},"required":["page_id","title","position"],"additionalProperties":false}}},"required":["id","title","description","topics","items"],"additionalProperties":false}}},"required":["success","data"]},"AtlasMemberPage":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"page_version_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"space_id":{"type":["string","null"],"format":"uuid"},"space_name":{"type":["string","null"]},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"next_review_date":{"type":["string","null"],"format":"date"},"published_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"content":{"type":"string"},"display_order":{"type":"integer","minimum":0}},"required":["id","title","content","display_order"],"additionalProperties":false}}},"required":["page_id","page_version_id","title","description","space_id","space_name","category","tags","topics","version_major","version_minor","last_reviewed_date","next_review_date","published_at","updated_at","sections"],"additionalProperties":false},"AtlasMemberPageResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"page_version_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"space_id":{"type":["string","null"],"format":"uuid"},"space_name":{"type":["string","null"]},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"next_review_date":{"type":["string","null"],"format":"date"},"published_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"content":{"type":"string"},"display_order":{"type":"integer","minimum":0}},"required":["id","title","content","display_order"],"additionalProperties":false}}},"required":["page_id","page_version_id","title","description","space_id","space_name","category","tags","topics","version_major","version_minor","last_reviewed_date","next_review_date","published_at","updated_at","sections"],"additionalProperties":false}},"required":["success","data"]},"AtlasMemberTree":{"type":"object","properties":{"spaces":{"type":"array","items":{"type":"object","properties":{"space_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"pages":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"parent_page_id":{"type":["string","null"],"format":"uuid"},"position":{"type":"integer","minimum":0},"title":{"type":"string"},"space_id":{"type":["string","null"],"format":"uuid"},"version_major":{"type":["integer","null"],"minimum":0},"version_minor":{"type":["integer","null"],"minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["page_id","parent_page_id","position","title","space_id","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}}},"required":["space_id","name","pages"],"additionalProperties":false}},"ungrouped_pages":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"parent_page_id":{"type":["string","null"],"format":"uuid"},"position":{"type":"integer","minimum":0},"title":{"type":"string"},"space_id":{"type":["string","null"],"format":"uuid"},"version_major":{"type":["integer","null"],"minimum":0},"version_minor":{"type":["integer","null"],"minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["page_id","parent_page_id","position","title","space_id","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}},"collections":{"type":"array","items":{"type":"object","properties":{"collection_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"parent_page_id":{"type":["string","null"],"format":"uuid"},"position":{"type":"integer","minimum":0},"title":{"type":"string"},"space_id":{"type":["string","null"],"format":"uuid"},"version_major":{"type":["integer","null"],"minimum":0},"version_minor":{"type":["integer","null"],"minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["page_id","parent_page_id","position","title","space_id","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}}},"required":["collection_id","title","items"],"additionalProperties":false}}},"required":["spaces","ungrouped_pages","collections"],"additionalProperties":false},"AtlasMemberTreeResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"spaces":{"type":"array","items":{"type":"object","properties":{"space_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"pages":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"parent_page_id":{"type":["string","null"],"format":"uuid"},"position":{"type":"integer","minimum":0},"title":{"type":"string"},"space_id":{"type":["string","null"],"format":"uuid"},"version_major":{"type":["integer","null"],"minimum":0},"version_minor":{"type":["integer","null"],"minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["page_id","parent_page_id","position","title","space_id","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}}},"required":["space_id","name","pages"],"additionalProperties":false}},"ungrouped_pages":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"parent_page_id":{"type":["string","null"],"format":"uuid"},"position":{"type":"integer","minimum":0},"title":{"type":"string"},"space_id":{"type":["string","null"],"format":"uuid"},"version_major":{"type":["integer","null"],"minimum":0},"version_minor":{"type":["integer","null"],"minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["page_id","parent_page_id","position","title","space_id","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}},"collections":{"type":"array","items":{"type":"object","properties":{"collection_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"parent_page_id":{"type":["string","null"],"format":"uuid"},"position":{"type":"integer","minimum":0},"title":{"type":"string"},"space_id":{"type":["string","null"],"format":"uuid"},"version_major":{"type":["integer","null"],"minimum":0},"version_minor":{"type":["integer","null"],"minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["page_id","parent_page_id","position","title","space_id","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}}},"required":["collection_id","title","items"],"additionalProperties":false}}},"required":["spaces","ungrouped_pages","collections"],"additionalProperties":false}},"required":["success","data"]},"AtlasPageDraft":{"type":"object","properties":{"lineage_id":{"type":"string","format":"uuid"},"version_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"status":{"type":"string","enum":["draft"]},"section_count":{"type":"integer","exclusiveMinimum":0},"warnings":{"type":"array","items":{"type":"string"},"description":"Human-readable import warnings, such as a front-matter topic that was not assigned or markup the sanitiser removed. Empty when there are none."}},"required":["lineage_id","version_id","title","status","section_count","warnings"],"additionalProperties":false},"AtlasPageCreatedResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"lineage_id":{"type":"string","format":"uuid"},"version_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"status":{"type":"string","enum":["draft"]},"section_count":{"type":"integer","exclusiveMinimum":0},"warnings":{"type":"array","items":{"type":"string"},"description":"Human-readable import warnings, such as a front-matter topic that was not assigned or markup the sanitiser removed. Empty when there are none."}},"required":["lineage_id","version_id","title","status","section_count","warnings"],"additionalProperties":false}},"required":["success","data"]},"AtlasPageSubmission":{"type":"object","properties":{"lineage_id":{"type":"string","format":"uuid"},"version_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["in_review"]}},"required":["lineage_id","version_id","status"],"additionalProperties":false},"AtlasPageSubmittedResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"lineage_id":{"type":"string","format":"uuid"},"version_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["in_review"]}},"required":["lineage_id","version_id","status"],"additionalProperties":false}},"required":["success","data"]},"CmsNestedAccessGate":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["access-gate"]},"access":{"type":"object","properties":{"mode":{"type":"string","enum":["public","authenticated","active_member","selected_tiers","segments","selected_entitlements"],"description":"Which policy arm produced this outcome: `public`, `authenticated` (any signed-in user), `active_member` (an active membership), `selected_tiers` (specific membership tiers — which tiers is deliberately not disclosed), `segments` (a tenant-defined audience — which audience is deliberately not disclosed)."},"state":{"type":"string","enum":["granted","authentication_required","membership_required","plan_required","access_restricted"],"description":"The caller's access outcome for this content. How to parse: `granted` — the caller may read the content (fragments are present). `authentication_required` — no (valid) user bearer was supplied; supplying one MAY grant access, render a sign-in affordance. `membership_required` — the authenticated user holds no active membership with this organisation; only used by membership-based policies. `plan_required` — the user holds a membership, but not one this content is available to; do NOT prompt them to join (they already belong), indicate a different tier is required. `access_restricted` — the generic denial for audience (segment) based policies: the user is authenticated but not in the required audience; neither joining nor changing tier is implied, render neutral restricted-content copy."}},"required":["mode","state"]}},"required":["id","type","access"]},"CmsContainerChild":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["access-gate"]},"access":{"type":"object","properties":{"mode":{"type":"string","enum":["public","authenticated","active_member","selected_tiers","segments","selected_entitlements"],"description":"Which policy arm produced this outcome: `public`, `authenticated` (any signed-in user), `active_member` (an active membership), `selected_tiers` (specific membership tiers — which tiers is deliberately not disclosed), `segments` (a tenant-defined audience — which audience is deliberately not disclosed)."},"state":{"type":"string","enum":["granted","authentication_required","membership_required","plan_required","access_restricted"],"description":"The caller's access outcome for this content. How to parse: `granted` — the caller may read the content (fragments are present). `authentication_required` — no (valid) user bearer was supplied; supplying one MAY grant access, render a sign-in affordance. `membership_required` — the authenticated user holds no active membership with this organisation; only used by membership-based policies. `plan_required` — the user holds a membership, but not one this content is available to; do NOT prompt them to join (they already belong), indicate a different tier is required. `access_restricted` — the generic denial for audience (segment) based policies: the user is authenticated but not in the required audience; neither joining nor changing tier is implied, render neutral restricted-content copy."}},"required":["mode","state"]}},"required":["id","type","access"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"payload":{}},"required":["id","type"]}]},"MembershipAlreadyHeldDetails":{"type":"object","properties":{"portal_url":{"type":"string","format":"uri"}},"required":["portal_url"]},"CrmOrderPaidEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.order.paid"],"description":"Namespaced event id for this delivery.","example":"crm.order.paid"},"data":{"type":"object","properties":{"order_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"order_number":{"type":"string"},"order_type":{"type":"string","enum":["membership","renewal","one_time","product","event","course"]},"total_cents":{"type":"integer","minimum":0,"description":"The order's value — what was billed. Never the money actually received: an offline invoice can settle on a part payment, and an event that reports what arrived carries its own field for it."},"currency":{"type":"string"},"paid_at":{"type":"string","description":"ISO timestamp when payment completed"},"amount_received_cents":{"type":"integer","minimum":0,"description":"Money actually received against the order in cents. Equals `total_cents` on a payment in full. Carried by the renewal fulfilment paths; absent on emitters that predate it."},"shortfall_cents":{"type":"integer","minimum":0,"description":"What the order fell short of `total_cents` by, in cents. Zero on a payment in full. Non-zero means the order was settled — and access granted — on a part payment, with the balance still outstanding at the accounting provider."},"external_id":{"type":["string","null"],"description":"Provider session / payment-intent id, if known. Null for cash, cheque, or back-office completion."}},"required":["order_id","account_id","contact_id","order_number","order_type","total_cents","currency","paid_at","external_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmOrderFailedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.order.failed"],"description":"Namespaced event id for this delivery.","example":"crm.order.failed"},"data":{"type":"object","properties":{"order_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"order_number":{"type":"string"},"order_type":{"type":"string","enum":["membership","renewal","one_time","product","event","course"]},"total_cents":{"type":"integer","minimum":0,"description":"The order's value — what was billed. Never the money actually received: an offline invoice can settle on a part payment, and an event that reports what arrived carries its own field for it."},"currency":{"type":"string"},"failed_at":{"type":"string"},"reason":{"type":["string","null"],"description":"Human-readable failure reason. Provider details are scrubbed."}},"required":["order_id","account_id","contact_id","order_number","order_type","total_cents","currency","failed_at","reason"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmOrderRefundedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.order.refunded"],"description":"Namespaced event id for this delivery.","example":"crm.order.refunded"},"data":{"type":"object","properties":{"order_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"order_number":{"type":"string"},"order_type":{"type":"string","enum":["membership","renewal","one_time","product","event","course"]},"total_cents":{"type":"integer","minimum":0,"description":"The order's value — what was billed. Never the money actually received: an offline invoice can settle on a part payment, and an event that reports what arrived carries its own field for it."},"currency":{"type":"string"},"refunded_at":{"type":"string"},"refund_cents":{"type":"integer","exclusiveMinimum":0,"description":"Amount refunded in cents. May be less than total_cents."},"partial":{"type":"boolean"}},"required":["order_id","account_id","contact_id","order_number","order_type","total_cents","currency","refunded_at","refund_cents","partial"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmMembershipCreatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.membership.created"],"description":"Namespaced event id for this delivery.","example":"crm.membership.created"},"data":{"type":"object","properties":{"membership_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","description":"Membership status after the transition, e.g. active, grace or lapsed."},"company_id":{"type":["string","null"],"format":"uuid","description":"Owning company for a corporate membership. Null otherwise."},"start_date":{"type":"string","description":"Membership start (ISO date)."},"renewal_date":{"type":["string","null"],"description":"Next renewal due date (ISO date). Null for lifetime tiers."},"expiry_date":{"type":["string","null"],"description":"Membership expiry (ISO date). Null when open-ended."}},"required":["membership_id","account_id","contact_id","tier_id","status","company_id","start_date","renewal_date","expiry_date"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmMembershipUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.membership.updated"],"description":"Namespaced event id for this delivery.","example":"crm.membership.updated"},"data":{"type":"object","properties":{"membership_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","description":"Membership status after the transition, e.g. active, grace or lapsed."},"previous_status":{"type":["string","null"],"description":"Status before the change, which can be grace. Null when only the tier changed."},"previous_tier_id":{"type":["string","null"],"format":"uuid","description":"Tier before the change. Null when the tier did not change."},"renewal_date":{"type":["string","null"],"description":"Renewal due date after the change (ISO date)."},"expiry_date":{"type":["string","null"],"description":"Expiry after the change (ISO date)."},"updated_at":{"type":"string","description":"ISO timestamp of the change."}},"required":["membership_id","account_id","contact_id","tier_id","status","previous_status","previous_tier_id","renewal_date","expiry_date","updated_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmMembershipCancelledEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.membership.cancelled"],"description":"Namespaced event id for this delivery.","example":"crm.membership.cancelled"},"data":{"type":"object","properties":{"membership_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","description":"Membership status after the transition, e.g. active, grace or lapsed."},"previous_status":{"type":"string","description":"The status the membership held before cancellation."},"cancelled_at":{"type":"string","description":"ISO timestamp the membership was cancelled."},"reason":{"type":["string","null"],"description":"Staff-entered cancellation reason when provided, or `refund` when a refund, lost dispute or sold-out refund reversed the order."}},"required":["membership_id","account_id","contact_id","tier_id","status","previous_status","cancelled_at","reason"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmMembershipRenewedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.membership.renewed"],"description":"Namespaced event id for this delivery.","example":"crm.membership.renewed"},"data":{"type":"object","properties":{"membership_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","description":"Membership status after the transition, e.g. active, grace or lapsed."},"order_id":{"type":"string","format":"uuid","description":"The renewal order whose payment drove this transition."},"renewed_at":{"type":"string","description":"ISO timestamp the renewal was fulfilled."},"expiry_date":{"type":["string","null"],"description":"New membership expiry (ISO date). Null for lifetime tiers."},"renewal_date":{"type":["string","null"],"description":"Next renewal due date (ISO date). Null for lifetime tiers."}},"required":["membership_id","account_id","contact_id","tier_id","status","order_id","renewed_at","expiry_date","renewal_date"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmMembershipReinstatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.membership.reinstated"],"description":"Namespaced event id for this delivery.","example":"crm.membership.reinstated"},"data":{"type":"object","properties":{"membership_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","description":"Membership status after the transition, e.g. active, grace or lapsed."},"order_id":{"type":["string","null"],"format":"uuid","description":"The renewal order whose payment drove this transition. Null when staff renewed a membership in grace without a payment."},"renewed_at":{"type":"string","description":"ISO timestamp the renewal was fulfilled."},"expiry_date":{"type":["string","null"],"description":"New membership expiry (ISO date). Null for lifetime tiers."},"renewal_date":{"type":["string","null"],"description":"Next renewal due date (ISO date). Null for lifetime tiers."},"previous_status":{"type":"string","description":"The status the membership held before reinstatement (grace, lapsed, expired, or cancelled)."}},"required":["membership_id","account_id","contact_id","tier_id","status","order_id","renewed_at","expiry_date","renewal_date","previous_status"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmMembershipLapsedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.membership.lapsed"],"description":"Namespaced event id for this delivery.","example":"crm.membership.lapsed"},"data":{"type":"object","properties":{"membership_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","description":"Membership status after the transition, e.g. active, grace or lapsed."},"lapsed_at":{"type":"string","description":"ISO timestamp the membership lapsed."},"expiry_date":{"type":["string","null"],"description":"The expiry date that elapsed without renewal (ISO date)."},"reason":{"type":["string","null"],"description":"Machine-readable lapse reason, e.g. grace_period_expired."},"previous_status":{"type":"string","description":"The status the membership held immediately before it lapsed, for example active or grace. Absent when it was not recorded."}},"required":["membership_id","account_id","contact_id","tier_id","status","lapsed_at","expiry_date","reason"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmMembershipGraceStartedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.membership.grace_started"],"description":"Namespaced event id for this delivery.","example":"crm.membership.grace_started"},"data":{"type":"object","properties":{"membership_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","description":"Membership status after the transition, e.g. active, grace or lapsed."},"previous_status":{"type":"string","description":"The status the membership held before grace, always active."},"grace_ends_on":{"type":"string","description":"The last day of grace (ISO date) in the organisation time zone. The membership lapses at the start of the following day unless it is paid."}},"required":["membership_id","account_id","contact_id","tier_id","status","previous_status","grace_ends_on"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmMembershipSeatsAffectedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.membership.seats_affected"],"description":"Namespaced event id for this delivery.","example":"crm.membership.seats_affected"},"data":{"type":"object","properties":{"membership_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"tier_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","description":"Corporate membership status after the change, which can be grace."},"previous_status":{"type":["string","null"],"description":"Corporate membership status before the change, which can be grace."},"holds_standing":{"type":"boolean","description":"Whether the corporate membership now grants standing to its active seat holders, judged by status only (not by dates). False when it entered grace, lapsed, expired or was cancelled; true when it was reinstated."},"seat_count":{"type":"integer","minimum":0,"description":"Total active seat holders across every batch of this change. Count the ids you have received against it."},"batch_index":{"type":"integer","minimum":0,"description":"Zero-based position of this event among the batches."},"batch_count":{"type":"integer","exclusiveMinimum":0,"description":"How many events carry this change, so a consumer knows when it has them all."},"seat_contact_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000,"description":"Contact ids of the active seat holders in this batch: at most 1,000 per event. Across all batches every active seat holder appears exactly once."}},"required":["membership_id","account_id","company_id","tier_id","status","previous_status","holds_standing","seat_count","batch_index","batch_count","seat_contact_ids"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmSeatAddedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.seat.added"],"description":"Namespaced event id for this delivery.","example":"crm.seat.added"},"data":{"type":"object","properties":{"seat_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"corporate_membership_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid","description":"The seat holder contact. Null for an unassigned seat."},"status":{"type":"string","description":"Seat status after the transition, e.g. active or disabled."},"role":{"type":"string","description":"Seat role, e.g. admin or member."},"added_at":{"type":"string","description":"ISO timestamp the seat was added."}},"required":["seat_id","account_id","corporate_membership_id","contact_id","status","role","added_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmSeatUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.seat.updated"],"description":"Namespaced event id for this delivery.","example":"crm.seat.updated"},"data":{"type":"object","properties":{"seat_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"corporate_membership_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid","description":"The seat holder contact. Null for an unassigned seat."},"status":{"type":"string","description":"Seat status after the transition, e.g. active or disabled."},"role":{"type":"string","description":"Seat role, e.g. admin or member."},"previous_status":{"type":["string","null"],"description":"Status before the change. Null when only the role changed."},"previous_role":{"type":["string","null"],"description":"Role before the change. Null when only the status changed."},"updated_at":{"type":"string","description":"ISO timestamp of the change."}},"required":["seat_id","account_id","corporate_membership_id","contact_id","status","role","previous_status","previous_role","updated_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmSeatRemovedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.seat.removed"],"description":"Namespaced event id for this delivery.","example":"crm.seat.removed"},"data":{"type":"object","properties":{"seat_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"corporate_membership_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid","description":"The seat holder contact. Null for an unassigned seat."},"status":{"type":"string","description":"Seat status after the transition, e.g. active or disabled."},"role":{"type":"string","description":"Seat role, e.g. admin or member."},"removed_at":{"type":"string","description":"ISO timestamp the seat was removed."}},"required":["seat_id","account_id","corporate_membership_id","contact_id","status","role","removed_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmSubscriptionSuspendedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.subscription.suspended"],"description":"Namespaced event id for this delivery.","example":"crm.subscription.suspended"},"data":{"type":"object","properties":{"subscription_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"product_type":{"type":"string","description":"Subscription product type, e.g. insurance."},"status":{"type":"string","description":"Subscription status after the transition."},"suspended_at":{"type":"string","description":"ISO timestamp the subscription was suspended."},"suspension_reason":{"type":["string","null"],"description":"Why the subscription was suspended, e.g. membership_inactive."},"governing_membership_id":{"type":["string","null"],"format":"uuid","description":"Membership whose lapse cascaded to this suspension, if any."}},"required":["subscription_id","account_id","contact_id","product_type","status","suspended_at","suspension_reason","governing_membership_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmSubscriptionReactivatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.subscription.reactivated"],"description":"Namespaced event id for this delivery.","example":"crm.subscription.reactivated"},"data":{"type":"object","properties":{"subscription_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"product_type":{"type":"string","description":"Subscription product type, e.g. insurance."},"status":{"type":"string","description":"Subscription status after the transition."},"reactivated_at":{"type":"string","description":"ISO timestamp the subscription returned to active."},"governing_membership_id":{"type":["string","null"],"format":"uuid","description":"Membership whose reinstatement cascaded this reactivation."}},"required":["subscription_id","account_id","contact_id","product_type","status","reactivated_at","governing_membership_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmOrderDisputedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.order.disputed"],"description":"Namespaced event id for this delivery.","example":"crm.order.disputed"},"data":{"type":"object","properties":{"order_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"gateway_dispute_ref":{"type":"string","description":"Gateway-native dispute id, e.g. a Stripe dispute (dp_...)."},"amount_cents":{"type":"integer","minimum":0,"description":"Disputed amount in cents."},"currency":{"type":"string"},"reason":{"type":["string","null"],"description":"Gateway-reported dispute reason, e.g. fraudulent."},"disputed_at":{"type":"string","description":"ISO timestamp the dispute was opened."}},"required":["order_id","account_id","contact_id","gateway_dispute_ref","amount_cents","currency","reason","disputed_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmOrderDisputeResolvedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.order.dispute_resolved"],"description":"Namespaced event id for this delivery.","example":"crm.order.dispute_resolved"},"data":{"type":"object","properties":{"order_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"gateway_dispute_ref":{"type":"string","description":"Gateway-native dispute id, e.g. a Stripe dispute (dp_...)."},"outcome":{"type":"string","enum":["won","lost"],"description":"Dispute outcome. A lost dispute additionally reverses the order."},"resolved_at":{"type":"string","description":"ISO timestamp the dispute was closed."}},"required":["order_id","account_id","contact_id","gateway_dispute_ref","outcome","resolved_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmEntitlementGrantedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.entitlement.granted"],"description":"Namespaced event id for this delivery.","example":"crm.entitlement.granted"},"data":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid","description":"The member whose grants changed. Locate the member by this id, then re-read their entitlements."},"gate_keys":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Every entitlement key that changed in this write, sorted and de-duplicated. One event carries them all."},"source_key":{"type":["string","null"],"description":"The entitlement source that owns the changed grants, e.g. `manual` for a staff grant or an integration's own key. Null when no single source applies."},"granted_via":{"type":"string","enum":["direct"],"description":"How the capability reaches the member. Always `direct`: a grant event is never raised for a tier-derived capability, which follows the membership events instead. Matches the `granted_via` values of `GET /v1/crm/me/entitlements`."}},"required":["account_id","contact_id","gate_keys","source_key","granted_via"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmEntitlementRevokedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.entitlement.revoked"],"description":"Namespaced event id for this delivery.","example":"crm.entitlement.revoked"},"data":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid","description":"The member whose grants changed. Locate the member by this id, then re-read their entitlements."},"gate_keys":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Every entitlement key that changed in this write, sorted and de-duplicated. One event carries them all."},"source_key":{"type":["string","null"],"description":"The entitlement source that owns the changed grants, e.g. `manual` for a staff grant or an integration's own key. Null when no single source applies."},"granted_via":{"type":"string","enum":["direct"],"description":"How the capability reaches the member. Always `direct`: a grant event is never raised for a tier-derived capability, which follows the membership events instead. Matches the `granted_via` values of `GET /v1/crm/me/entitlements`."}},"required":["account_id","contact_id","gate_keys","source_key","granted_via"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmBenefitChangedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.benefit.changed"],"description":"Namespaced event id for this delivery.","example":"crm.benefit.changed"},"data":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"tier_id":{"type":["string","null"],"format":"uuid","description":"The membership tier whose benefit assignment changed. Null when the change is to the benefit itself."},"benefit_id":{"type":["string","null"],"format":"uuid","description":"The benefit that was assigned, removed, activated, deactivated or re-keyed."},"change":{"type":"string","enum":["tier_benefit_added","tier_benefit_removed","benefit_activated","benefit_deactivated","benefit_gate_key_changed"],"description":"What happened. When one write both re-keys and activates or deactivates a benefit, `benefit_gate_key_changed` is reported once."}},"required":["account_id","tier_id","benefit_id","change"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmContactAttributesChangedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.contact.attributes_changed"],"description":"Namespaced event id for this delivery.","example":"crm.contact.attributes_changed"},"data":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"changed_fields":{"type":"array","items":{"type":"string"},"minItems":1,"description":"The segment rule field ids that changed, sorted and de-duplicated: `sys-status`, `sys-tags`, `sys-follows-topic`, or `custom-<field_key>` for a custom field. Names only, never values."},"contact_id":{"type":"string","format":"uuid","description":"The Agend contact (`crm_contacts.id`) whose segment-relevant fields changed. Locate the member by this id, then re-read their segments and entitlements."}},"required":["account_id","changed_fields","contact_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmContactBulkUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.contact.bulk_updated"],"description":"Namespaced event id for this delivery.","example":"crm.contact.bulk_updated"},"data":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"changed_fields":{"type":"array","items":{"type":"string"},"minItems":1,"description":"The segment rule field ids that changed, sorted and de-duplicated: `sys-status`, `sys-tags`, `sys-follows-topic`, or `custom-<field_key>` for a custom field. Names only, never values."},"contact_count":{"type":"integer","minimum":1,"description":"How many contacts the bulk write changed. The contacts are not listed: treat every member of the account as possibly changed."}},"required":["account_id","changed_fields","contact_count"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"CrmSegmentUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["crm.segment.updated"],"description":"Namespaced event id for this delivery.","example":"crm.segment.updated"},"data":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"segment_id":{"type":"string","format":"uuid","description":"The segment that was created, redefined or deleted. For a deleted segment the id no longer resolves."},"change":{"type":"string","enum":["created","criteria_changed","deleted"],"description":"What happened: `created`, `criteria_changed` (its filter rules were edited) or `deleted`. The criteria themselves are never included."}},"required":["account_id","segment_id","change"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"EventsEventPublishedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["events.event.published"],"description":"Namespaced event id for this delivery.","example":"events.event.published"},"data":{"type":"object","properties":{"event_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"published_at":{"type":"string"},"scheduled":{"type":"boolean","description":"true if published_at is in the future"}},"required":["event_id","account_id","slug","name","published_at","scheduled"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"EventsEventUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["events.event.updated"],"description":"Namespaced event id for this delivery.","example":"events.event.updated"},"data":{"type":"object","properties":{"event_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"updated_at":{"type":"string"},"changed_fields":{"type":"array","items":{"type":"string"},"description":"Names of the event columns that changed in this update. Empty when an audit-only touch happened."}},"required":["event_id","account_id","slug","name","updated_at","changed_fields"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"EventsEventCancelledEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["events.event.cancelled"],"description":"Namespaced event id for this delivery.","example":"events.event.cancelled"},"data":{"type":"object","properties":{"event_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"cancelled_at":{"type":"string"}},"required":["event_id","account_id","slug","name","cancelled_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"EventsEventDeletedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["events.event.deleted"],"description":"Namespaced event id for this delivery.","example":"events.event.deleted"},"data":{"type":"object","properties":{"event_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"deleted_at":{"type":"string"}},"required":["event_id","account_id","slug","name","deleted_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"JobsSubmissionApprovedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["jobs.submission.approved"],"description":"Namespaced event id for this delivery.","example":"jobs.submission.approved"},"data":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The submitted job."},"account_id":{"type":"string","format":"uuid"},"credit_ref":{"type":"string","description":"The credit reference: an opaque value a connected site sent for a submission made before the website submission routes, or the `uniqueid` of the CRM job credit a `/v1/jobs/submissions` post spent."},"contact_id":{"type":["string","null"],"format":"uuid","description":"The submitting contact. Null when the contact has since been deleted."},"contact_external_id":{"type":["string","null"],"description":"The submitting contact's external id (`crm_contacts.external_id`), or null."},"contact_external_source":{"type":["string","null"],"description":"The submitting contact's external source (`crm_contacts.external_source`), or null. Together with `contact_external_id` it is the contact pair. Absent on events queued before this field was added."},"occurred_at":{"type":"string","description":"ISO timestamp of the state change."},"status":{"type":"string","enum":["published"],"description":"The job is live on the board for the board default period."}},"required":["job_id","account_id","credit_ref","contact_id","contact_external_id","occurred_at","status"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"JobsSubmissionRejectedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["jobs.submission.rejected"],"description":"Namespaced event id for this delivery.","example":"jobs.submission.rejected"},"data":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The submitted job."},"account_id":{"type":"string","format":"uuid"},"credit_ref":{"type":"string","description":"The credit reference: an opaque value a connected site sent for a submission made before the website submission routes, or the `uniqueid` of the CRM job credit a `/v1/jobs/submissions` post spent."},"contact_id":{"type":["string","null"],"format":"uuid","description":"The submitting contact. Null when the contact has since been deleted."},"contact_external_id":{"type":["string","null"],"description":"The submitting contact's external id (`crm_contacts.external_id`), or null."},"contact_external_source":{"type":["string","null"],"description":"The submitting contact's external source (`crm_contacts.external_source`), or null. Together with `contact_external_id` it is the contact pair. Absent on events queued before this field was added."},"occurred_at":{"type":"string","description":"ISO timestamp of the state change."},"status":{"type":"string","enum":["rejected"],"description":"Terminal. The credit reference is released for reuse and any CRM job credit spend is released."}},"required":["job_id","account_id","credit_ref","contact_id","contact_external_id","occurred_at","status"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"JobsSubmissionWithdrawnEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["jobs.submission.withdrawn"],"description":"Namespaced event id for this delivery.","example":"jobs.submission.withdrawn"},"data":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The submitted job."},"account_id":{"type":"string","format":"uuid"},"credit_ref":{"type":"string","description":"The credit reference: an opaque value a connected site sent for a submission made before the website submission routes, or the `uniqueid` of the CRM job credit a `/v1/jobs/submissions` post spent."},"contact_id":{"type":["string","null"],"format":"uuid","description":"The submitting contact. Null when the contact has since been deleted."},"contact_external_id":{"type":["string","null"],"description":"The submitting contact's external id (`crm_contacts.external_id`), or null."},"contact_external_source":{"type":["string","null"],"description":"The submitting contact's external source (`crm_contacts.external_source`), or null. Together with `contact_external_id` it is the contact pair. Absent on events queued before this field was added."},"occurred_at":{"type":"string","description":"ISO timestamp of the state change."},"status":{"type":"string","enum":["withdrawn"],"description":"Terminal. The credit reference is released for reuse and any CRM job credit spend is released."}},"required":["job_id","account_id","credit_ref","contact_id","contact_external_id","occurred_at","status"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentCreatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.created"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.created"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"enrolled_at":{"type":"string","description":"ISO timestamp of the enrollment row."},"seat_license_id":{"type":["string","null"],"format":"uuid"},"access_expires_at":{"type":["string","null"],"description":"The expiry instant the enrolment was created with, read back after the insert. Null when it has no expiry instant yet."}},"required":["enrollment_id","course_id","user_id","account_id","enrolled_at","seat_license_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentCompletedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.completed"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.completed"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"completed_at":{"type":"string"},"progress_percentage":{"type":"number","minimum":0,"maximum":100}},"required":["enrollment_id","course_id","user_id","account_id","completed_at","progress_percentage"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentCancelledEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.cancelled"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.cancelled"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"cancelled_at":{"type":"string","description":"ISO timestamp of the unenrolment. The row no longer exists."}},"required":["enrollment_id","course_id","user_id","account_id","cancelled_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentResetEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.reset"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.reset"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"reset_at":{"type":"string","description":"ISO timestamp of the progress reset. Lesson progress was cleared and the enrollment returned to 0% incomplete."}},"required":["enrollment_id","course_id","user_id","account_id","reset_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentMilestoneEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.milestone"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.milestone"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"milestone":{"type":"integer","minimum":1,"maximum":99,"description":"The course-configured threshold that was crossed. 100% is announced via lms.enrollment.completed instead."},"progress_percentage":{"type":"number","minimum":0,"maximum":100,"description":"Progress at emit time. May exceed the milestone when a single update jumps past several thresholds (each emits its own event)."},"reached_at":{"type":"string"}},"required":["enrollment_id","course_id","user_id","account_id","milestone","progress_percentage","reached_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentExpiredEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.expired"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.expired"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"expired_at":{"type":"string","description":"ISO timestamp access was revoked."},"expiry_reason":{"type":"string","description":"Why access ended: 'time_limit' (course access window lapsed) or 'seat_license' (the backing licence lapsed or was deactivated)."},"access_mode":{"type":"string","description":"Post-expiry access state per the course's expiry behaviour: 'expired' (lockout) or 'read_only'."}},"required":["enrollment_id","course_id","user_id","account_id","expired_at","expiry_reason","access_mode"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentAccessExtendedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.access_extended"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.access_extended"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"access_expires_at":{"type":["string","null"],"description":"The new expiry instant after the extension."},"extended_by_days":{"type":"integer","minimum":1},"actor_id":{"type":["string","null"],"format":"uuid","description":"Admin who granted the extension, when known."}},"required":["enrollment_id","course_id","user_id","account_id","access_expires_at","extended_by_days","actor_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentAccessRestoredEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.access_restored"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.access_restored"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"access_expires_at":{"type":["string","null"],"description":"The expiry instant after restoration. Null when access was restored with no time limit."},"actor_id":{"type":["string","null"],"format":"uuid","description":"Admin who restored access, when known."}},"required":["enrollment_id","course_id","user_id","account_id","access_expires_at","actor_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.updated"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.updated"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"access_expires_at":{"type":["string","null"],"description":"The new expiry instant. Null means no known expiry instant, not permanently unlimited; a first-access countdown has none until first_accessed_at is set."},"previous_access_expires_at":{"type":["string","null"],"description":"The enrolment expiry instant before this change."},"first_accessed_at":{"type":["string","null"],"description":"When the learner first opened the course; null until then."},"actor_id":{"type":["string","null"],"format":"uuid","description":"The signed-in user whose change this was; null for service-role and scheduled writes."},"registration_ref":{"type":["string","null"],"description":"The enrolment's reference in an external system of record (for an Upbeat purchase, the Registration id); null when there is none."},"source":{"type":"string","description":"The enrolment source; current values are purchase, membership, seat, manual, and external_purchase."},"change_source":{"type":"string","enum":["database_update"],"description":"Always database_update: the event was captured from the committed database write."}},"required":["enrollment_id","course_id","user_id","account_id","access_expires_at","previous_access_expires_at","first_accessed_at","actor_id","registration_ref","source","change_source"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsEnrollmentOwnerLifecycleEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.enrollment.owner_lifecycle"],"description":"Namespaced event id for this delivery.","example":"lms.enrollment.owner_lifecycle"},"data":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"change_kind":{"type":"string","enum":["created","completed","revoked"]}},"required":["enrollment_id","course_id","user_id","account_id","change_kind"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCourseCreatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.course.created"],"description":"Namespaced event id for this delivery.","example":"lms.course.created"},"data":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"],"format":"uuid"}},"required":["course_id","account_id","slug","title","created_at","created_by"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCourseUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.course.updated"],"description":"Namespaced event id for this delivery.","example":"lms.course.updated"},"data":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"updated_at":{"type":"string"},"changed_fields":{"type":"array","items":{"type":"string"},"description":"Names of the course columns that changed in this update. Empty when only audit columns were touched."}},"required":["course_id","account_id","slug","title","updated_at","changed_fields"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCourseDeletedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.course.deleted"],"description":"Namespaced event id for this delivery.","example":"lms.course.deleted"},"data":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"deleted_at":{"type":"string"}},"required":["course_id","account_id","slug","title","deleted_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCourseConcludedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.course.concluded"],"description":"Namespaced event id for this delivery.","example":"lms.course.concluded"},"data":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"concluded_at":{"type":"string"},"actor_id":{"type":["string","null"],"format":"uuid"}},"required":["course_id","account_id","slug","title","concluded_at","actor_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCourseArchivedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.course.archived"],"description":"Namespaced event id for this delivery.","example":"lms.course.archived"},"data":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"archived_at":{"type":"string"},"from_status":{"type":"string","description":"The status the course was archived from (draft, published, or concluded)."},"actor_id":{"type":["string","null"],"format":"uuid"}},"required":["course_id","account_id","slug","title","archived_at","from_status","actor_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCoursePurgedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.course.purged"],"description":"Namespaced event id for this delivery.","example":"lms.course.purged"},"data":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"purged_at":{"type":"string"},"records_deleted":{"type":"integer","minimum":0,"description":"Total rows removed across all cascade-deleted tables."},"audit_id":{"type":"string","format":"uuid"},"actor_id":{"type":["string","null"],"format":"uuid"}},"required":["course_id","account_id","slug","title","purged_at","records_deleted","audit_id","actor_id"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCourseDuplicatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.course.duplicated"],"description":"Namespaced event id for this delivery.","example":"lms.course.duplicated"},"data":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"source_course_id":{"type":"string","format":"uuid","description":"The archived course this copy was created from."},"created_at":{"type":"string"},"created_by":{"type":["string","null"],"format":"uuid"}},"required":["course_id","account_id","slug","title","source_course_id","created_at","created_by"],"description":"course_id, slug, and title identify the NEW draft course; source_course_id is the template it was copied from."}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCoursePublishedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.course.published"],"description":"Namespaced event id for this delivery.","example":"lms.course.published"},"data":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"published_at":{"type":"string"},"actor_id":{"type":["string","null"],"format":"uuid"}},"required":["course_id","account_id","slug","title","published_at","actor_id"],"description":"Fires alongside the generic lms.course.updated event so existing subscribers that diff changed_fields keep working."}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCourseUnpublishedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.course.unpublished"],"description":"Namespaced event id for this delivery.","example":"lms.course.unpublished"},"data":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"unpublished_at":{"type":"string"},"actor_id":{"type":["string","null"],"format":"uuid"}},"required":["course_id","account_id","slug","title","unpublished_at","actor_id"],"description":"Fires alongside the generic lms.course.updated event so existing subscribers that diff changed_fields keep working."}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsLessonCreatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.lesson.created"],"description":"Namespaced event id for this delivery.","example":"lms.lesson.created"},"data":{"type":"object","properties":{"lesson_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the parent course. Lesson rows do not carry account_id directly."},"title":{"type":"string"},"order_index":{"type":"integer","minimum":0},"created_at":{"type":"string"}},"required":["lesson_id","course_id","account_id","title","order_index","created_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsLessonUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.lesson.updated"],"description":"Namespaced event id for this delivery.","example":"lms.lesson.updated"},"data":{"type":"object","properties":{"lesson_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the parent course. Lesson rows do not carry account_id directly."},"title":{"type":"string"},"updated_at":{"type":"string"},"changed_fields":{"type":"array","items":{"type":"string"}}},"required":["lesson_id","course_id","account_id","title","updated_at","changed_fields"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsLessonDeletedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.lesson.deleted"],"description":"Namespaced event id for this delivery.","example":"lms.lesson.deleted"},"data":{"type":"object","properties":{"lesson_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the parent course. Lesson rows do not carry account_id directly."},"title":{"type":"string"},"deleted_at":{"type":"string"}},"required":["lesson_id","course_id","account_id","title","deleted_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsQuizCreatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.quiz.created"],"description":"Namespaced event id for this delivery.","example":"lms.quiz.created"},"data":{"type":"object","properties":{"quiz_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the parent course."},"title":{"type":"string"},"created_at":{"type":"string"}},"required":["quiz_id","course_id","account_id","title","created_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsQuizUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.quiz.updated"],"description":"Namespaced event id for this delivery.","example":"lms.quiz.updated"},"data":{"type":"object","properties":{"quiz_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the parent course."},"title":{"type":"string"},"updated_at":{"type":"string"},"changed_fields":{"type":"array","items":{"type":"string"}}},"required":["quiz_id","course_id","account_id","title","updated_at","changed_fields"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsQuizDeletedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.quiz.deleted"],"description":"Namespaced event id for this delivery.","example":"lms.quiz.deleted"},"data":{"type":"object","properties":{"quiz_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the parent course."},"title":{"type":"string"},"deleted_at":{"type":"string"}},"required":["quiz_id","course_id","account_id","title","deleted_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsBadgeAwardedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.badge.awarded"],"description":"Namespaced event id for this delivery.","example":"lms.badge.awarded"},"data":{"type":"object","properties":{"badge_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the badge course."},"badge_name":{"type":"string"},"awarded_at":{"type":"string"}},"required":["badge_id","user_id","course_id","account_id","badge_name","awarded_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsBadgeRevokedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.badge.revoked"],"description":"Namespaced event id for this delivery.","example":"lms.badge.revoked"},"data":{"type":"object","properties":{"badge_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the badge course."},"badge_name":{"type":"string"},"revoked_at":{"type":"string"}},"required":["badge_id","user_id","course_id","account_id","badge_name","revoked_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCertificateIssuedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.certificate.issued"],"description":"Namespaced event id for this delivery.","example":"lms.certificate.issued"},"data":{"type":"object","properties":{"certificate_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the certificate course."},"certificate_number":{"type":"string"},"issued_at":{"type":"string"}},"required":["certificate_id","user_id","course_id","account_id","certificate_number","issued_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsCertificateRevokedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.certificate.revoked"],"description":"Namespaced event id for this delivery.","example":"lms.certificate.revoked"},"data":{"type":"object","properties":{"certificate_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the certificate course."},"certificate_number":{"type":"string"},"revoked_at":{"type":"string"}},"required":["certificate_id","user_id","course_id","account_id","certificate_number","revoked_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsSessionCreatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.session.created"],"description":"Namespaced event id for this delivery.","example":"lms.session.created"},"data":{"type":"object","properties":{"session_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the session course."},"title":{"type":"string"},"status":{"type":"string"},"starts_at":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["session_id","course_id","account_id","title","status","starts_at","created_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsSessionUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.session.updated"],"description":"Namespaced event id for this delivery.","example":"lms.session.updated"},"data":{"type":"object","properties":{"session_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the session course."},"title":{"type":"string"},"status":{"type":"string"},"updated_at":{"type":"string"},"changed_fields":{"type":"array","items":{"type":"string"}}},"required":["session_id","course_id","account_id","title","status","updated_at","changed_fields"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsSessionDeletedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.session.deleted"],"description":"Namespaced event id for this delivery.","example":"lms.session.deleted"},"data":{"type":"object","properties":{"session_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the session course."},"title":{"type":"string"},"deleted_at":{"type":"string"}},"required":["session_id","course_id","account_id","title","deleted_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsSessionRegistrationCreatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.session.registration.created"],"description":"Namespaced event id for this delivery.","example":"lms.session.registration.created"},"data":{"type":"object","properties":{"registration_id":{"type":"string","format":"uuid"},"session_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the session course."},"status":{"type":"string","description":"Initial registration status: 'registered', or 'waitlisted' when the session is at capacity."},"registered_at":{"type":"string"}},"required":["registration_id","session_id","course_id","user_id","account_id","status","registered_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsSessionRegistrationUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.session.registration.updated"],"description":"Namespaced event id for this delivery.","example":"lms.session.registration.updated"},"data":{"type":"object","properties":{"registration_id":{"type":"string","format":"uuid"},"session_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the session course."},"status":{"type":"string","description":"Current status: 'registered', 'waitlisted', 'attended', 'no_show', or 'cancelled'. Attendance check-in/out arrives via this event with the corresponding changed_fields."},"changed_fields":{"type":"array","items":{"type":"string"}},"updated_at":{"type":"string"}},"required":["registration_id","session_id","course_id","user_id","account_id","status","changed_fields","updated_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsSessionRegistrationCancelledEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.session.registration.cancelled"],"description":"Namespaced event id for this delivery.","example":"lms.session.registration.cancelled"},"data":{"type":"object","properties":{"registration_id":{"type":"string","format":"uuid"},"session_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid","description":"Owning account of the session course."},"cancelled_at":{"type":"string"}},"required":["registration_id","session_id","course_id","user_id","account_id","cancelled_at"],"description":"Fires for both status cancellation and outright registration deletion."}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsPathCreatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.path.created"],"description":"Namespaced event id for this delivery.","example":"lms.path.created"},"data":{"type":"object","properties":{"path_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"created_at":{"type":"string"},"created_by":{"type":["string","null"],"format":"uuid"}},"required":["path_id","account_id","slug","title","created_at","created_by"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsPathUpdatedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.path.updated"],"description":"Namespaced event id for this delivery.","example":"lms.path.updated"},"data":{"type":"object","properties":{"path_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"updated_at":{"type":"string"},"changed_fields":{"type":"array","items":{"type":"string"}}},"required":["path_id","account_id","slug","title","updated_at","changed_fields"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LmsPathDeletedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["lms.path.deleted"],"description":"Namespaced event id for this delivery.","example":"lms.path.deleted"},"data":{"type":"object","properties":{"path_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"deleted_at":{"type":"string"}},"required":["path_id","account_id","slug","title","deleted_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LoopThreadRepliedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["loop.thread.replied"],"description":"Namespaced event id for this delivery.","example":"loop.thread.replied"},"data":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"channel_id":{"type":"string","format":"uuid"},"thread_id":{"type":"string","format":"uuid"},"reply_id":{"type":"string","format":"uuid"},"author_id":{"type":"string","format":"uuid"},"external_id":{"type":["string","null"]},"replied_at":{"type":"string"}},"required":["account_id","channel_id","thread_id","reply_id","author_id","replied_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"LoopUserMentionedEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Stable delivery id, unchanged across retries. Delivery is at-least-once — dedupe on this value."},"schema_version":{"type":"integer","description":"Major version of the payload shape. Bumps signal a breaking change."},"sequence":{"type":"integer","description":"Per-account monotonic sequence, strictly increasing in emission order. Order events for the same resource by this value (combine with `id` for dedupe). Not a wall clock; treat as monotonic, not contiguous.","example":42},"account_id":{"type":"string","format":"uuid","description":"Account the event belongs to."},"environment":{"type":"string","enum":["production","sandbox"],"description":"Environment of the account that emitted the event. Discard `sandbox` events in a production listener and `production` events in a staging listener. Read at delivery time, so a retry of an event emitted before an account was designated a sandbox reports the current environment.","example":"production"},"created_at":{"type":"string","format":"date-time","description":"ISO-8601 UTC timestamp at the moment of emission."},"type":{"type":"string","enum":["loop.user.mentioned"],"description":"Namespaced event id for this delivery.","example":"loop.user.mentioned"},"data":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"channel_id":{"type":"string","format":"uuid"},"thread_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid","description":"The user who was mentioned."},"mentioned_by":{"type":"string","format":"uuid"},"message_preview":{"type":"string","maxLength":200},"mentioned_at":{"type":"string"}},"required":["account_id","channel_id","thread_id","user_id","mentioned_by","message_preview","mentioned_at"]}},"required":["id","schema_version","sequence","account_id","environment","created_at","type","data"]},"WebhookSubscription":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"},"failed_deliveries_count":{"type":"integer"},"last_delivery_at":{"type":["string","null"],"format":"date-time"},"last_failure_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_by":{"type":["string","null"],"format":"uuid"}},"required":["id","account_id","url","description","events","active","failed_deliveries_count","last_delivery_at","last_failure_at","created_at","updated_at","created_by"]},"WebhookApiError":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{}}},"required":["code","message"]}},"required":["error"]},"WebhookSubscriptionWithSecret":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"},"failed_deliveries_count":{"type":"integer"},"last_delivery_at":{"type":["string","null"],"format":"date-time"},"last_failure_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_by":{"type":["string","null"],"format":"uuid"},"secret":{"type":"string","description":"Signing secret shown ONCE at creation/rotation. Never retrievable afterwards."}},"required":["id","account_id","url","description","events","active","failed_deliveries_count","last_delivery_at","last_failure_at","created_at","updated_at","created_by","secret"]},"CreateWebhookSubscriptionBody":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"HTTPS endpoint that will receive deliveries."},"description":{"type":"string","maxLength":200},"events":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":64,"description":"Namespaced event ids to subscribe to. See the per-event webhooks: entries for available ids."}},"required":["url","events"]},"UpdateWebhookSubscriptionBody":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"description":{"type":"string","maxLength":200},"events":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":64},"active":{"type":"boolean"}}},"WebhookSubscriptionDeletedResult":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["deleted"]}},"required":["id","status"]},"WebhookRotateSecretResult":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"secret":{"type":"string"}},"required":["id","secret"]},"WebhookTestResult":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":["integer","null"]},"error":{"type":["string","null"]}},"required":["ok","status","error"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"outbox_id":{"type":"string","format":"uuid"},"subscription_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"event_type":{"type":"string"},"attempt":{"type":"integer"},"status":{"type":"string","enum":["pending","pending_retry","delivered","failed"]},"next_retry_at":{"type":["string","null"],"format":"date-time"},"response_status":{"type":["integer","null"]},"response_body":{"type":["string","null"]},"error":{"type":["string","null"]},"delivered_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","outbox_id","subscription_id","account_id","event_type","attempt","status","next_retry_at","response_status","response_body","error","delivered_at","created_at","updated_at"]},"WebhookReplayResult":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]},"AuthUser":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"}},"required":["id","email"]},"AuthContact":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"}},"required":["id","account_id"]},"AuthSession":{"type":"object","properties":{"access_token":{"type":"string"},"refresh_token":{"type":"string"},"expires_at":{"type":"integer","minimum":0},"expires_in":{"type":"integer","minimum":0},"token_type":{"type":"string","enum":["bearer"]}},"required":["access_token","refresh_token","expires_at","expires_in","token_type"]},"LoginResponse":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/AuthUser"},"contact":{"$ref":"#/components/schemas/AuthContact"},"session":{"$ref":"#/components/schemas/AuthSession"},"is_account_admin":{"type":"boolean"},"link_status":{"type":"string","enum":["linked","pending_claim"]}},"required":["user","contact","session","is_account_admin","link_status"]},"LoginEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoginResponse"}},"required":["success","data"]},"OwnershipVerificationResponse":{"type":"object","properties":{"status":{"type":"string","enum":["verification_required"]},"message":{"type":"string","minLength":1}},"required":["status","message"]},"MfaRequiredResponse":{"type":"object","properties":{"status":{"type":"string","enum":["mfa_required"]},"mfa_token":{"type":"string","minLength":1},"factors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"factor_type":{"type":"string","enum":["totp"]},"friendly_name":{"type":["string","null"]}},"required":["id","factor_type","friendly_name"],"additionalProperties":false},"minItems":1}},"required":["status","mfa_token","factors"],"additionalProperties":false},"PendingLoginResponse":{"anyOf":[{"$ref":"#/components/schemas/OwnershipVerificationResponse"},{"$ref":"#/components/schemas/MfaRequiredResponse"}]},"PendingLoginEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/PendingLoginResponse"}},"required":["success","data"]},"LoginBody":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"},"password":{"type":"string","minLength":1,"maxLength":72}},"required":["email","password"],"additionalProperties":false},"VerifyMfaBody":{"type":"object","properties":{"mfa_token":{"type":"string","minLength":1,"maxLength":512},"factor_id":{"type":"string","format":"uuid"},"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["mfa_token","factor_id","code"],"additionalProperties":false},"RegisterResponse":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/AuthUser"},"contact":{"$ref":"#/components/schemas/AuthContact"},"session":{"allOf":[{"$ref":"#/components/schemas/AuthSession"},{"type":["object","null"]}]},"pending_email_confirmation":{"type":"boolean"},"link_status":{"type":["string","null"],"enum":["linked","pending_claim"]}},"required":["user","contact","session","pending_email_confirmation","link_status"]},"RegisterEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/RegisterResponse"}},"required":["success","data"]},"RegisterBody":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"},"password":{"type":"string","minLength":8,"maxLength":72},"contact":{"type":"object","properties":{"first_name":{"type":"string","maxLength":100},"last_name":{"type":"string","maxLength":100},"phone":{"type":"string","maxLength":50},"company":{"type":"string","maxLength":200},"job_title":{"type":"string","maxLength":200}},"additionalProperties":false},"redirect_to":{"type":"string","maxLength":2048,"pattern":"^[a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/[^\\s]+$"},"create_contact":{"type":"boolean"},"invitation_token":{"type":"string","minLength":1,"maxLength":512}},"required":["email","password"],"additionalProperties":false},"RefreshResponse":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/AuthUser"},"session":{"$ref":"#/components/schemas/AuthSession"}},"required":["user","session"]},"RefreshEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/RefreshResponse"}},"required":["success","data"]},"RefreshBody":{"type":"object","properties":{"refresh_token":{"type":"string","minLength":1,"maxLength":4096}},"required":["refresh_token"],"additionalProperties":false},"AuthStatusResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok","pending"]}},"required":["status"]},"LogoutEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthStatusResponse"}},"required":["success","data"]},"SessionHandoffResponse":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"]},"SessionHandoffEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SessionHandoffResponse"}},"required":["success","data"]},"OwnershipVerificationEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/OwnershipVerificationResponse"}},"required":["success","data"]},"SessionHandoffBody":{"type":"object","properties":{"destination":{"type":"string","enum":["home","checkout"]}}},"ResendVerificationBody":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"}},"required":["email"],"additionalProperties":false},"ForgotPasswordEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthStatusResponse"}},"required":["success","data"]},"ForgotPasswordBody":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"},"redirect_to":{"type":"string","maxLength":2048,"pattern":"^[a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/[^\\s]+$","description":"Deprecated and ignored. Accepted so existing callers keep working; the recovery link always lands on the Agend member portal.","deprecated":true}},"required":["email"],"additionalProperties":false},"ResetPasswordEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthStatusResponse"}},"required":["success","data"]},"ResetPasswordBody":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"},"token":{"type":"string","minLength":1,"maxLength":1024},"new_password":{"type":"string","minLength":8,"maxLength":72}},"required":["email","token","new_password"],"additionalProperties":false},"ChangePasswordEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthStatusResponse"}},"required":["success","data"]},"ChangePasswordBody":{"type":"object","properties":{"current_password":{"type":"string","minLength":1,"maxLength":72},"new_password":{"type":"string","minLength":8,"maxLength":72}},"required":["current_password","new_password"],"additionalProperties":false},"CartSession":{"type":["object","null"],"properties":{"discount_code":{"type":["string","null"]},"discount_code_cleared_reason":{"type":["string","null"],"enum":["buyer_changed"]},"discount_quote":{"type":["object","null"],"properties":{"code":{"type":["string","null"]},"applies":{"type":"boolean"},"refusal_message":{"type":["string","null"]},"version":{"type":"string"},"undiscounted_total_cents":{"type":"integer","minimum":0},"discount_cents":{"type":"integer","minimum":0},"subtotal_cents":{"type":"integer","minimum":0},"tax_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0},"show_gst":{"type":"boolean"},"lines":{"type":"array","items":{"type":"object","properties":{"cart_item_id":{"type":"string","format":"uuid"},"discount_cents":{"type":"integer","minimum":0},"subtotal_cents":{"type":"integer","minimum":0},"tax_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0},"tax_treatment":{"type":"string","enum":["taxable","gst_free","input_taxed"]}},"required":["cart_item_id","discount_cents","subtotal_cents","tax_cents","total_cents","tax_treatment"]}}},"required":["code","applies","refusal_message","version","undiscounted_total_cents","discount_cents","subtotal_cents","tax_cents","total_cents","show_gst","lines"]},"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"user_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","enum":["current","locked","complete","abandoned"]},"total_amount":{"type":"number"},"item_count":{"type":"integer"},"currency":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"cart_session_id":{"type":"string","format":"uuid"},"product_type":{"type":"string"},"product_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"quantity":{"type":"integer"},"unit_amount":{"type":"number"},"currency":{"type":"string"},"metadata":{"type":"object","properties":{"attendees":{"type":"array","items":{"type":"object","properties":{"beneficiary_type":{"type":"string","enum":["self","named","unnamed"]},"beneficiary_name":{"type":"string"},"beneficiary_email":{"type":"string","format":"email"},"beneficiary_contact_id":{"type":"string","format":"uuid"},"custom_fields":{"type":"object","additionalProperties":{}}},"required":["beneficiary_type"]}},"add_on_quote":{"type":"object","properties":{"paymentDefaultPolicy":{"type":["object","null"],"properties":{"version":{"type":"string","format":"uuid"},"confirmedAt":{"type":"string","format":"date-time"},"graceDays":{"type":"integer","minimum":0,"maximum":365},"suspendAction":{"type":"string","enum":["suspend","hold"]},"restoreAllowed":{"type":"boolean"}},"required":["version","confirmedAt","graceDays","suspendAction","restoreAllowed"]},"productId":{"type":"string","format":"uuid"},"productName":{"type":"string"},"displayLabels":{"type":"object","properties":{"singular":{"type":["string","null"]},"plural":{"type":["string","null"]},"priceLabel":{"type":["string","null"]},"termLabel":{"type":["string","null"]},"certificateLabel":{"type":["string","null"]}},"additionalProperties":false},"quoteVersion":{"type":"string"},"annualReferencePriceCents":{"type":"integer","minimum":0},"totalCents":{"type":"integer","minimum":0},"subtotalCents":{"type":"integer","minimum":0},"taxCents":{"type":"integer","minimum":0},"dueTodayCents":{"type":"integer","minimum":0},"currency":{"type":"string","enum":["AUD"]},"termStart":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"},"renewalBoundary":{"type":"string","format":"date"},"paymentChoice":{"type":"string","enum":["full","instalments"]},"instalments":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"integer","exclusiveMinimum":0},"dueDate":{"type":"string","format":"date"},"amountCents":{"type":"integer","exclusiveMinimum":0}},"required":["sequence","dueDate","amountCents"]}}},"required":["productId","productName","quoteVersion","annualReferencePriceCents","totalCents","subtotalCents","taxCents","dueTodayCents","currency","termStart","endDate","renewalBoundary","paymentChoice","instalments"]},"cart_fulfilment":{"type":"object","properties":{"status":{"type":"string","enum":["payment_received","activation_pending","fulfilled","failed"]},"payment_received":{"type":"boolean","enum":[true]},"updated_at":{"type":"string","format":"date-time"}},"required":["status","payment_received","updated_at"]}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","cart_session_id","product_type","product_id","name","quantity","unit_amount","currency","created_at","updated_at"]}}},"required":["id","account_id","user_id","status","total_amount","item_count","currency","created_at","updated_at","items"]},"CheckoutOptionsResponse":{"type":"object","properties":{"invoice":{"type":"object","properties":{"available":{"type":"boolean"},"reason":{"type":["string","null"],"enum":["invoice_disabled","buyer_not_found","buyer_not_approved","unsupported_product_type","authentication_required","empty_cart","ticket_capacity_unavailable","ticket_reservation_window_closed","event_unavailable","invoice_unavailable"]},"reasonMessage":{"type":["string","null"]},"dueAt":{"type":["string","null"],"format":"date-time"},"dueLocalDate":{"type":["string","null"],"format":"date"},"timezone":{"type":["string","null"]},"ticketCutoffAt":{"type":["string","null"],"format":"date-time"},"ticketCutoffShortened":{"type":"boolean"},"purchaseOrderRequired":{"type":"boolean"},"termsDays":{"type":["integer","null"]},"paymentInstructions":{"type":["string","null"]},"releasePolicies":{"type":"object","additionalProperties":{"type":"string","enum":["invoice_accepted","payment_confirmed"]}},"unsupportedProductTypes":{"type":"array","items":{"type":"string"}},"approvedCompanyIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["available","reason","reasonMessage","dueAt","dueLocalDate","timezone","ticketCutoffAt","ticketCutoffShortened","purchaseOrderRequired","termsDays","paymentInstructions","releasePolicies","unsupportedProductTypes","approvedCompanyIds"]}},"required":["invoice"]},"AddItemResponse":{"type":"object","properties":{"cart":{"type":"object","properties":{"discount_code":{"type":["string","null"]},"discount_code_cleared_reason":{"type":["string","null"],"enum":["buyer_changed"]},"discount_quote":{"type":["object","null"],"properties":{"code":{"type":["string","null"]},"applies":{"type":"boolean"},"refusal_message":{"type":["string","null"]},"version":{"type":"string"},"undiscounted_total_cents":{"type":"integer","minimum":0},"discount_cents":{"type":"integer","minimum":0},"subtotal_cents":{"type":"integer","minimum":0},"tax_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0},"show_gst":{"type":"boolean"},"lines":{"type":"array","items":{"type":"object","properties":{"cart_item_id":{"type":"string","format":"uuid"},"discount_cents":{"type":"integer","minimum":0},"subtotal_cents":{"type":"integer","minimum":0},"tax_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0},"tax_treatment":{"type":"string","enum":["taxable","gst_free","input_taxed"]}},"required":["cart_item_id","discount_cents","subtotal_cents","tax_cents","total_cents","tax_treatment"]}}},"required":["code","applies","refusal_message","version","undiscounted_total_cents","discount_cents","subtotal_cents","tax_cents","total_cents","show_gst","lines"]},"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"user_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","enum":["current","locked","complete","abandoned"]},"total_amount":{"type":"number"},"item_count":{"type":"integer"},"currency":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"cart_session_id":{"type":"string","format":"uuid"},"product_type":{"type":"string"},"product_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"quantity":{"type":"integer"},"unit_amount":{"type":"number"},"currency":{"type":"string"},"metadata":{"type":"object","properties":{"attendees":{"type":"array","items":{"type":"object","properties":{"beneficiary_type":{"type":"string","enum":["self","named","unnamed"]},"beneficiary_name":{"type":"string"},"beneficiary_email":{"type":"string","format":"email"},"beneficiary_contact_id":{"type":"string","format":"uuid"},"custom_fields":{"type":"object","additionalProperties":{}}},"required":["beneficiary_type"]}},"add_on_quote":{"type":"object","properties":{"paymentDefaultPolicy":{"type":["object","null"],"properties":{"version":{"type":"string","format":"uuid"},"confirmedAt":{"type":"string","format":"date-time"},"graceDays":{"type":"integer","minimum":0,"maximum":365},"suspendAction":{"type":"string","enum":["suspend","hold"]},"restoreAllowed":{"type":"boolean"}},"required":["version","confirmedAt","graceDays","suspendAction","restoreAllowed"]},"productId":{"type":"string","format":"uuid"},"productName":{"type":"string"},"displayLabels":{"type":"object","properties":{"singular":{"type":["string","null"]},"plural":{"type":["string","null"]},"priceLabel":{"type":["string","null"]},"termLabel":{"type":["string","null"]},"certificateLabel":{"type":["string","null"]}},"additionalProperties":false},"quoteVersion":{"type":"string"},"annualReferencePriceCents":{"type":"integer","minimum":0},"totalCents":{"type":"integer","minimum":0},"subtotalCents":{"type":"integer","minimum":0},"taxCents":{"type":"integer","minimum":0},"dueTodayCents":{"type":"integer","minimum":0},"currency":{"type":"string","enum":["AUD"]},"termStart":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"},"renewalBoundary":{"type":"string","format":"date"},"paymentChoice":{"type":"string","enum":["full","instalments"]},"instalments":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"integer","exclusiveMinimum":0},"dueDate":{"type":"string","format":"date"},"amountCents":{"type":"integer","exclusiveMinimum":0}},"required":["sequence","dueDate","amountCents"]}}},"required":["productId","productName","quoteVersion","annualReferencePriceCents","totalCents","subtotalCents","taxCents","dueTodayCents","currency","termStart","endDate","renewalBoundary","paymentChoice","instalments"]},"cart_fulfilment":{"type":"object","properties":{"status":{"type":"string","enum":["payment_received","activation_pending","fulfilled","failed"]},"payment_received":{"type":"boolean","enum":[true]},"updated_at":{"type":"string","format":"date-time"}},"required":["status","payment_received","updated_at"]}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","cart_session_id","product_type","product_id","name","quantity","unit_amount","currency","created_at","updated_at"]}}},"required":["id","account_id","user_id","status","total_amount","item_count","currency","created_at","updated_at","items"]},"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"cart_session_id":{"type":"string","format":"uuid"},"product_type":{"type":"string"},"product_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"quantity":{"type":"integer"},"unit_amount":{"type":"number"},"currency":{"type":"string"},"metadata":{"type":"object","properties":{"attendees":{"type":"array","items":{"type":"object","properties":{"beneficiary_type":{"type":"string","enum":["self","named","unnamed"]},"beneficiary_name":{"type":"string"},"beneficiary_email":{"type":"string","format":"email"},"beneficiary_contact_id":{"type":"string","format":"uuid"},"custom_fields":{"type":"object","additionalProperties":{}}},"required":["beneficiary_type"]}},"add_on_quote":{"type":"object","properties":{"paymentDefaultPolicy":{"type":["object","null"],"properties":{"version":{"type":"string","format":"uuid"},"confirmedAt":{"type":"string","format":"date-time"},"graceDays":{"type":"integer","minimum":0,"maximum":365},"suspendAction":{"type":"string","enum":["suspend","hold"]},"restoreAllowed":{"type":"boolean"}},"required":["version","confirmedAt","graceDays","suspendAction","restoreAllowed"]},"productId":{"type":"string","format":"uuid"},"productName":{"type":"string"},"displayLabels":{"type":"object","properties":{"singular":{"type":["string","null"]},"plural":{"type":["string","null"]},"priceLabel":{"type":["string","null"]},"termLabel":{"type":["string","null"]},"certificateLabel":{"type":["string","null"]}},"additionalProperties":false},"quoteVersion":{"type":"string"},"annualReferencePriceCents":{"type":"integer","minimum":0},"totalCents":{"type":"integer","minimum":0},"subtotalCents":{"type":"integer","minimum":0},"taxCents":{"type":"integer","minimum":0},"dueTodayCents":{"type":"integer","minimum":0},"currency":{"type":"string","enum":["AUD"]},"termStart":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"},"renewalBoundary":{"type":"string","format":"date"},"paymentChoice":{"type":"string","enum":["full","instalments"]},"instalments":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"integer","exclusiveMinimum":0},"dueDate":{"type":"string","format":"date"},"amountCents":{"type":"integer","exclusiveMinimum":0}},"required":["sequence","dueDate","amountCents"]}}},"required":["productId","productName","quoteVersion","annualReferencePriceCents","totalCents","subtotalCents","taxCents","dueTodayCents","currency","termStart","endDate","renewalBoundary","paymentChoice","instalments"]},"cart_fulfilment":{"type":"object","properties":{"status":{"type":"string","enum":["payment_received","activation_pending","fulfilled","failed"]},"payment_received":{"type":"boolean","enum":[true]},"updated_at":{"type":"string","format":"date-time"}},"required":["status","payment_received","updated_at"]}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","cart_session_id","product_type","product_id","name","quantity","unit_amount","currency","created_at","updated_at"]},"guestSessionToken":{"type":"string"}},"required":["cart","item"]},"CartItemAttendeeInput":{"type":"object","properties":{"beneficiary_type":{"type":"string","enum":["self","named","unnamed"]},"beneficiary_name":{"type":"string"},"beneficiary_email":{"type":"string","format":"email"},"beneficiary_contact_id":{"type":"string","format":"uuid"},"custom_fields":{"type":"object","additionalProperties":{}}},"required":["beneficiary_type"],"description":"One seat's attendee detail. beneficiary_type: self (the buyer) | named (a third party with known name/email or contact id) | unnamed (a placeholder seat, named later). custom_fields values are keyed by field_key and validated against the ticket's event attendee-field definitions (entity_type='event_attendee', container_id = event id) at this route."},"CartItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"cart_session_id":{"type":"string","format":"uuid"},"product_type":{"type":"string"},"product_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"quantity":{"type":"integer"},"unit_amount":{"type":"number"},"currency":{"type":"string"},"metadata":{"type":"object","properties":{"attendees":{"type":"array","items":{"type":"object","properties":{"beneficiary_type":{"type":"string","enum":["self","named","unnamed"]},"beneficiary_name":{"type":"string"},"beneficiary_email":{"type":"string","format":"email"},"beneficiary_contact_id":{"type":"string","format":"uuid"},"custom_fields":{"type":"object","additionalProperties":{}}},"required":["beneficiary_type"]}},"add_on_quote":{"type":"object","properties":{"paymentDefaultPolicy":{"type":["object","null"],"properties":{"version":{"type":"string","format":"uuid"},"confirmedAt":{"type":"string","format":"date-time"},"graceDays":{"type":"integer","minimum":0,"maximum":365},"suspendAction":{"type":"string","enum":["suspend","hold"]},"restoreAllowed":{"type":"boolean"}},"required":["version","confirmedAt","graceDays","suspendAction","restoreAllowed"]},"productId":{"type":"string","format":"uuid"},"productName":{"type":"string"},"displayLabels":{"type":"object","properties":{"singular":{"type":["string","null"]},"plural":{"type":["string","null"]},"priceLabel":{"type":["string","null"]},"termLabel":{"type":["string","null"]},"certificateLabel":{"type":["string","null"]}},"additionalProperties":false},"quoteVersion":{"type":"string"},"annualReferencePriceCents":{"type":"integer","minimum":0},"totalCents":{"type":"integer","minimum":0},"subtotalCents":{"type":"integer","minimum":0},"taxCents":{"type":"integer","minimum":0},"dueTodayCents":{"type":"integer","minimum":0},"currency":{"type":"string","enum":["AUD"]},"termStart":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"},"renewalBoundary":{"type":"string","format":"date"},"paymentChoice":{"type":"string","enum":["full","instalments"]},"instalments":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"integer","exclusiveMinimum":0},"dueDate":{"type":"string","format":"date"},"amountCents":{"type":"integer","exclusiveMinimum":0}},"required":["sequence","dueDate","amountCents"]}}},"required":["productId","productName","quoteVersion","annualReferencePriceCents","totalCents","subtotalCents","taxCents","dueTodayCents","currency","termStart","endDate","renewalBoundary","paymentChoice","instalments"]},"cart_fulfilment":{"type":"object","properties":{"status":{"type":"string","enum":["payment_received","activation_pending","fulfilled","failed"]},"payment_received":{"type":"boolean","enum":[true]},"updated_at":{"type":"string","format":"date-time"}},"required":["status","payment_received","updated_at"]}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","cart_session_id","product_type","product_id","name","quantity","unit_amount","currency","created_at","updated_at"],"description":"A cart line, returned with existing siblings in the owned cart after an item is added. Add-on quote metadata contains public accepted money, term, payment choice, version, schedule, product-specific display wording and confirmed default-policy grace/consequence/restoration facts. Display wording does not change product kind, payment obligations or policy requirements. Persisted fulfilment progress excludes internal failure details. A failed activation retries against the existing captured payment."},"RemoveItemResponse":{"type":"object","properties":{"status":{"type":"string","enum":["removed"]}},"required":["status"]},"TransferResponse":{"type":"object","properties":{"status":{"type":"string","enum":["transferred"]},"cart_id":{"type":"string","format":"uuid"}},"required":["status","cart_id"]},"DeleteResponse":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]},"CancelCheckoutResponse":{"type":"object","properties":{"status":{"type":"string","enum":["cancelled"]}},"required":["status"]},"CompleteCheckoutResponse":{"type":"object","properties":{"order_id":{"type":"string","format":"uuid"},"order_number":{"type":"string"},"paid_at":{"type":"string","format":"date-time"},"rail":{"type":"string","enum":["own_catalogue","marketplace"]},"payment_receipt_id":{"type":"string","format":"uuid"},"items":{"type":"array","items":{"type":"object","properties":{"cart_item_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"obligation_id":{"type":"string","format":"uuid"},"invoice_order_id":{"type":"string","format":"uuid"},"allocation_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"term_id":{"type":["string","null"],"format":"uuid"},"subscription_id":{"type":"string","format":"uuid"},"fulfilment_status":{"type":"string","enum":["activation_pending","fulfilled","failed"]},"subscription_status":{"type":"string"},"start_date":{"type":"string","format":"date"},"end_date":{"type":["string","null"],"format":"date"},"date_label":{"type":"string"}},"required":["cart_item_id","name","obligation_id","invoice_order_id","allocation_ids","term_id","fulfilment_status"]}}},"required":["order_id","order_number","paid_at","rail"]},"SimulateSuccessResponse":{"type":"object","properties":{"order_id":{"type":"string","format":"uuid"},"order_number":{"type":"string"},"paid_at":{"type":"string","format":"date-time"},"rail":{"type":"string","enum":["own_catalogue","marketplace"]},"payment_receipt_id":{"type":"string","format":"uuid"},"items":{"type":"array","items":{"type":"object","properties":{"cart_item_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"obligation_id":{"type":"string","format":"uuid"},"invoice_order_id":{"type":"string","format":"uuid"},"allocation_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"term_id":{"type":["string","null"],"format":"uuid"},"subscription_id":{"type":"string","format":"uuid"},"fulfilment_status":{"type":"string","enum":["activation_pending","fulfilled","failed"]},"subscription_status":{"type":"string"},"start_date":{"type":"string","format":"date"},"end_date":{"type":["string","null"],"format":"date"},"date_label":{"type":"string"}},"required":["cart_item_id","name","obligation_id","invoice_order_id","allocation_ids","term_id","fulfilment_status"]}}},"required":["order_id","order_number","paid_at","rail"]},"InvoiceAcceptanceResponse":{"type":"object","properties":{"orderId":{"type":"string","format":"uuid"},"orderNumber":{"type":"string","minLength":1},"invoiceOrderId":{"type":"string","format":"uuid"},"totalCents":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":1},"dueAt":{"type":"string","format":"date-time"},"dueLocalDate":{"type":"string","format":"date"},"timezone":{"type":"string","minLength":1},"purchaseOrderNumber":{"type":["string","null"]},"paymentInstructions":{"type":"string","minLength":1},"lines":{"type":"array","items":{"type":"object","properties":{"orderItemId":{"type":"string","format":"uuid"},"name":{"type":"string"},"productType":{"type":"string","minLength":1},"releasePolicy":{"type":"string","enum":["invoice_accepted","payment_confirmed"]}},"required":["orderItemId","name","productType","releasePolicy"]},"minItems":1}},"required":["orderId","orderNumber","invoiceOrderId","totalCents","currency","dueAt","dueLocalDate","timezone","purchaseOrderNumber","paymentInstructions","lines"]},"InvoiceOrderResponse":{"type":"object","properties":{"invoiceOrderId":{"type":"string","format":"uuid"},"orderId":{"type":"string","format":"uuid"},"orderNumber":{"type":"string","minLength":1},"purchaseOrderNumber":{"type":["string","null"]},"totalCents":{"type":"integer","exclusiveMinimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"receivedCents":{"type":"integer","minimum":0},"outstandingCents":{"type":"integer","minimum":0},"excessCents":{"type":"integer","minimum":0},"financialStatus":{"type":"string","enum":["unpaid","part_paid","payment_recorded","paid","exception","cancelled"]},"reconciliationStatus":{"type":"string","enum":["not_required","pending","confirmed","exception"]},"dueAt":{"type":"string","format":"date-time"},"dueLocalDate":{"type":"string","format":"date"},"timezone":{"type":"string","minLength":1},"paymentInstructions":{"type":"string","minLength":1},"acceptedAt":{"type":"string","format":"date-time"},"lines":{"type":"array","items":{"type":"object","properties":{"orderItemId":{"type":"string","format":"uuid"},"name":{"type":"string"},"productType":{"type":"string"},"productId":{"type":"string"},"quantity":{"type":"integer","exclusiveMinimum":0},"unitAmountCents":{"type":"integer"},"totalCents":{"type":"integer"},"releasePolicy":{"type":"string","enum":["invoice_accepted","payment_confirmed"]},"releaseStatus":{"type":"string","enum":["pending","awaiting_payment","processing","released","blocked","exception"]},"releasedAt":{"type":["string","null"],"format":"date-time"},"lastErrorCode":{"type":["string","null"]},"reservationStatus":{"type":["string","null"],"enum":["reserved","released","expired","cancelled","handled"]},"reservedUntil":{"type":["string","null"],"format":"date-time"}},"required":["orderItemId","name","productType","productId","quantity","unitAmountCents","totalCents","releasePolicy","releaseStatus","releasedAt","lastErrorCode","reservationStatus","reservedUntil"]}},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"amountCents":{"type":"integer","exclusiveMinimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"receivedAt":{"type":"string","format":"date-time"},"source":{"type":"string","enum":["manual","gateway"]},"reference":{"type":["string","null"]},"status":{"type":"string","enum":["active","exception","reversed"]},"reconciliationStatus":{"type":"string","enum":["not_required","pending","confirmed"]}},"required":["id","amountCents","currency","receivedAt","source","reference","status","reconciliationStatus"]}}},"required":["invoiceOrderId","orderId","orderNumber","purchaseOrderNumber","totalCents","currency","receivedCents","outstandingCents","excessCents","financialStatus","reconciliationStatus","dueAt","dueLocalDate","timezone","paymentInstructions","acceptedAt","lines","receipts"]},"CheckoutResponse":{"type":"object","properties":{"groups":{"type":"array","items":{"type":"object","properties":{"rail":{"type":"string","enum":["own_catalogue","marketplace"]},"settlementAccountId":{"type":"string","format":"uuid"},"checkoutUrl":{"type":"string","format":"uri"},"externalId":{"type":"string"},"subtotalCents":{"type":"integer"},"contractedTotalCents":{"type":"integer","minimum":0},"dueTodayCents":{"type":"integer","minimum":0},"expiresAt":{"type":"string","format":"date-time"},"gatewayType":{"type":"string"}},"required":["rail","settlementAccountId","checkoutUrl","externalId","subtotalCents","expiresAt"]}}},"required":["groups"]},"CmsContentItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":["string","null"],"format":"uuid"},"collection":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"content":{},"fragments":{"type":["array","null"],"items":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer"},"type":{"type":"string","enum":["access-gate"]},"access":{"type":"object","properties":{"mode":{"type":"string","enum":["public","authenticated","active_member","selected_tiers","segments","selected_entitlements"],"description":"Which policy arm produced this outcome: `public`, `authenticated` (any signed-in user), `active_member` (an active membership), `selected_tiers` (specific membership tiers — which tiers is deliberately not disclosed), `segments` (a tenant-defined audience — which audience is deliberately not disclosed)."},"state":{"type":"string","enum":["granted","authentication_required","membership_required","plan_required","access_restricted"],"description":"The caller's access outcome for this content. How to parse: `granted` — the caller may read the content (fragments are present). `authentication_required` — no (valid) user bearer was supplied; supplying one MAY grant access, render a sign-in affordance. `membership_required` — the authenticated user holds no active membership with this organisation; only used by membership-based policies. `plan_required` — the user holds a membership, but not one this content is available to; do NOT prompt them to join (they already belong), indicate a different tier is required. `access_restricted` — the generic denial for audience (segment) based policies: the user is authenticated but not in the required audience; neither joining nor changing tier is implied, render neutral restricted-content copy."}},"required":["mode","state"]}},"required":["id","position","type","access"]},{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"integer"},"type":{"type":"string"},"payload":{"description":"The block payload, opaque to this contract. A layout block (`block.container`, `block.row`) holds nested blocks under its slot keys (`children`; `col1` to `col4`); each nested entry is a `CmsContainerChild`, so a client iterating a slot must handle a nested `access-gate` entry."}},"required":["id","position","type"]}]}},"access":{"type":"object","properties":{"mode":{"type":"string","enum":["public","authenticated","active_member","selected_tiers","segments","selected_entitlements"],"description":"Which policy arm produced this outcome: `public`, `authenticated` (any signed-in user), `active_member` (an active membership), `selected_tiers` (specific membership tiers — which tiers is deliberately not disclosed), `segments` (a tenant-defined audience — which audience is deliberately not disclosed)."},"state":{"type":"string","enum":["granted","authentication_required","membership_required","plan_required","access_restricted"],"description":"The caller's access outcome for this content. How to parse: `granted` — the caller may read the content (fragments are present). `authentication_required` — no (valid) user bearer was supplied; supplying one MAY grant access, render a sign-in affordance. `membership_required` — the authenticated user holds no active membership with this organisation; only used by membership-based policies. `plan_required` — the user holds a membership, but not one this content is available to; do NOT prompt them to join (they already belong), indicate a different tier is required. `access_restricted` — the generic denial for audience (segment) based policies: the user is authenticated but not in the required audience; neither joining nor changing tier is implied, render neutral restricted-content copy."}},"required":["mode","state"]},"image":{"type":["string","null"]},"status":{"type":"string"},"label":{"type":["string","null"]},"language":{"type":"string"},"order_position":{"type":"integer"},"metadata":{"type":["object","null"],"additionalProperties":{}},"published_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]},"description":"Deprecated alias of topics. Sunset: 2027-03-05. Use topics for subject classification.","deprecated":true},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}}},"required":["id","account_id","collection","title","slug","description","fragments","access","image","status","label","language","order_position","metadata","published_at","created_at","updated_at","topics","categories","tags"]},"CmsContentListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/CmsContentItem"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"CmsSyncResult":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"outcome":{"type":"string","enum":["created","updated","unchanged"]},"revision":{"type":"string"}},"required":["id","outcome","revision"]},"CmsSyncResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CmsSyncResult"}},"required":["success","data"]},"CmsSyncCreatedResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CmsSyncResult"}},"required":["success","data"]},"CmsSyncContent":{"type":"object","properties":{"source":{"type":"object","properties":{"system":{"type":"string","minLength":1,"maxLength":64},"id":{"type":"string","minLength":1,"maxLength":128},"revision":{"type":"string","minLength":1,"maxLength":128},"url":{"type":["string","null"],"format":"uri"}},"required":["system","id","revision"]},"title":{"type":"string","minLength":1,"maxLength":500},"slug":{"type":"string","minLength":1,"maxLength":200},"collection":{"type":"string","minLength":1,"maxLength":100},"description":{"type":["string","null"],"maxLength":5000},"language":{"type":["string","null"],"maxLength":10},"published_at":{"type":["string","null"],"format":"date-time"},"image":{"type":["string","null"],"format":"uri"},"access_policy":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["public"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["active_member"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["selected_tiers"]},"tier_ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1}},"required":["mode","tier_ids"],"additionalProperties":false},{"type":"null"}]},"fragments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"position":{"type":"integer","minimum":0},"type":{"type":"string","minLength":1,"maxLength":64},"payload":{},"policy":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["public"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["active_member"]}},"required":["mode"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["selected_tiers"]},"tier_ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1}},"required":["mode","tier_ids"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["inherit"]}},"required":["mode"],"additionalProperties":false}]}},"required":["id","position","type","policy"]},"minItems":1,"maxItems":500},"metadata":{"type":["object","null"],"additionalProperties":{}}},"required":["source","title","slug","collection","fragments"]},"CmsContentResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CmsContentItem"}},"required":["success","data"]},"CmsDigitalProduct":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contentId":{"type":"string","format":"uuid"},"collection":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"image":{"type":["string","null"]},"currency":{"type":"string","enum":["AUD"]},"priceCents":{"type":"integer","minimum":0},"standardPriceCents":{"type":"integer","minimum":0},"memberDiscountApplied":{"type":"boolean"},"membersOnly":{"type":"boolean"},"purchaseState":{"type":"string","enum":["available","sign_in_required","membership_required","already_owned","unavailable"]},"publishedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","contentId","collection","slug","title","description","image","currency","priceCents","standardPriceCents","memberDiscountApplied","membersOnly","purchaseState","publishedAt"]},"CmsDigitalProductListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/CmsDigitalProduct"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"OwnedCmsDigitalProduct":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contentId":{"type":"string","format":"uuid"},"collection":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"image":{"type":["string","null"]},"currency":{"type":"string","enum":["AUD"]},"priceCents":{"type":"integer","minimum":0},"standardPriceCents":{"type":"integer","minimum":0},"memberDiscountApplied":{"type":"boolean"},"membersOnly":{"type":"boolean"},"purchaseState":{"type":"string","enum":["available","sign_in_required","membership_required","already_owned","unavailable"]},"publishedAt":{"type":["string","null"],"format":"date-time"},"assets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"fileName":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0}},"required":["id","fileName","mimeType","sizeBytes"]}}},"required":["id","contentId","collection","slug","title","description","image","currency","priceCents","standardPriceCents","memberDiscountApplied","membersOnly","purchaseState","publishedAt","assets"]},"OwnedCmsDigitalProductListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/OwnedCmsDigitalProduct"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"CmsDigitalProductResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CmsDigitalProduct"}},"required":["success","data"]},"CmsAssetDownload":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"expires_in":{"type":"integer","exclusiveMinimum":0},"file_name":{"type":"string"},"mime_type":{"type":"string"},"size_bytes":{"type":"integer","minimum":0}},"required":["url","expires_in","file_name","mime_type","size_bytes"]},"CmsAssetDownloadResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CmsAssetDownload"}},"required":["success","data"]},"CmsAssetRegistered":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"file_name":{"type":"string"},"mime_type":{"type":"string"},"size_bytes":{"type":"integer","minimum":0}},"required":["id","file_name","mime_type","size_bytes"]},"CmsAssetRegisteredResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CmsAssetRegistered"}},"required":["success","data"]},"PublicDirectoryCustomFieldResolved":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","textarea","number","dropdown","boolean","date","email","url","array","item_list"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"}]}}}]},"value_label":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Only present on an option-backed field (`dropdown`, or the multi-value `array` of a multi-select or checkbox group). The display label of the selected option, taken from the field's options, where `value` is the stable option value to filter on. A string for a single-value field; for a multi-value field an array of labels in the same order as `value`. A stored value that matches no option is returned unchanged in its place. Never present on a gate entry. The entry's own `label` is always the field's name."}},"required":["key","label","type","value"]},"PublicDirectoryCustomFieldGate":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"mode":{"type":"string","enum":["public","authenticated","active_member","selected_tiers","segments","selected_entitlements"],"description":"Which policy arm gated the field: `public` (never gates), `authenticated` (any signed-in user), `active_member` (an active membership), `selected_tiers` (specific membership tiers — which tiers is deliberately not disclosed), `segments` (a tenant-defined audience — which audience is deliberately not disclosed), `selected_entitlements` (named member entitlements — which entitlements is deliberately not disclosed)."},"state":{"type":"string","enum":["granted","authentication_required","membership_required","plan_required","access_restricted"],"description":"Why the caller cannot see this field's value. How to parse: `authentication_required` — the request carried no (valid) user bearer; supplying one MAY grant access, so render a sign-in affordance. `membership_required` — the authenticated user holds no active membership with this organisation; only used by membership-based policies. `plan_required` — the user holds a membership, but not one this field is available to; do NOT prompt them to join (they already belong), indicate a different tier is required. `access_restricted` — the generic denial for audience (segment) and entitlement based policies: the user is authenticated but not in the required audience / holds no named entitlement; neither joining nor changing tier is implied, render neutral restricted-content copy. `granted` never appears on a gate entry (a granted field is returned as a resolved value instead); it is reserved for envelope-level access summaries."},"gated":{"type":"boolean","enum":[true]}},"required":["key","label","mode","state","gated"],"description":"A custom field the caller is not entitled to see. Every such field has its own gate entry, at the position of that field among the other `custom_fields` entries, whether or not the listing holds a value for it, so a gate always means restricted and never means empty. A field the caller may see but the listing holds no data for has no entry at all."},"BusinessListing":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected","suspended"]},"is_featured":{"type":"boolean"},"view_count":{"type":"number"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"custom_fields":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/PublicDirectoryCustomFieldResolved"},{"$ref":"#/components/schemas/PublicDirectoryCustomFieldGate"}]}},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}},"primary_location":{"type":["object","null"],"properties":{"city":{"type":["string","null"]},"state":{"type":["string","null"]}},"required":["city","state"]}},"required":["id","account_id","name","slug","status","is_featured","view_count","created_at","updated_at","custom_fields","topics","primary_location"]},"DirectoryListingList":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/BusinessListing"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"PublicDirectoryDetailCustomFieldResolved":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","textarea","number","dropdown","boolean","date","email","url","array","item_list"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"}]}}}]},"value_label":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Only present on an option-backed field (`dropdown`, or the multi-value `array` of a multi-select or checkbox group). The display label of the selected option, taken from the field's options, where `value` is the stable option value to filter on. A string for a single-value field; for a multi-value field an array of labels in the same order as `value`. A stored value that matches no option is returned unchanged in its place. Never present on a gate entry. The entry's own `label` is always the field's name."},"item_fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number"]}},"required":["key","label","type"]},"description":"Only present on an `item_list` field whose definition declares item fields. Each item field's `key` (the key of that column in every object of `value`), display `label` and value `type` (`text` or `number`), in the order the administrator declared them: the column order and headings to render `value` with. Absent when the definition declares none, or its stored declaration cannot be read; a consumer then uses the keys of the items in `value`. Never present on a gate entry or on any other field type."}},"required":["key","label","type","value"]},"DirectoryListingDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"short_description":{"type":["string","null"]},"logo_url":{"type":["string","null"]},"hero_image_url":{"type":["string","null"]},"is_featured":{"type":"boolean"},"sponsor_level":{"type":"number"},"average_rating":{"type":["number","null"]},"review_count":{"type":"number"},"primary_category":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]},"primary_location":{"type":["object","null"],"properties":{"city":{"type":["string","null"]},"state":{"type":["string","null"]}},"required":["city","state"]},"badges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"icon":{"type":["string","null"]},"color":{"type":["string","null"]}},"required":["id","name","slug","icon","color"]}},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}},"custom_fields":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/PublicDirectoryDetailCustomFieldResolved"},{"$ref":"#/components/schemas/PublicDirectoryCustomFieldGate"}]}},"updated_at":{"type":"string","format":"date-time","description":"When the listing was last updated, as an ISO 8601 timestamp with offset. The same for every caller."},"description":{"type":["string","null"]},"phone":{"type":["string","null"],"description":"The listing's phone, or null when it has none. From `GET /v1/directory/listings/{slugOrId}` it is also null when the organisation hides phone in its directory form settings, or when an active field group naming `business_listings.phone` does not grant the request's viewer, for every caller, a `directory.listings.manage` key included."},"website":{"type":["string","null"]},"facebook_url":{"type":["string","null"]},"instagram_url":{"type":["string","null"]},"twitter_url":{"type":["string","null"]},"linkedin_url":{"type":["string","null"]},"youtube_url":{"type":["string","null"]},"business_hours":{"type":["object","null"],"additionalProperties":{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"},"closed":{"type":"boolean"}}}},"gallery_images":{"type":"array","items":{"type":"string"}},"meta_title":{"type":["string","null"]},"meta_description":{"type":["string","null"]},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"parent_id":{"type":["string","null"],"format":"uuid"},"is_active":{"type":"boolean"}},"required":["id","account_id","name","slug","parent_id","is_active"]}},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}},"locations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"address_line_1":{"type":["string","null"]},"address_line_2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postcode":{"type":["string","null"]},"country":{"type":["string","null"]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"phone":{"type":["string","null"],"description":"The location's phone, or null when it has none. From `GET /v1/directory/listings/{slugOrId}` it is also null when the organisation hides phone in its directory form settings, or when an active field group naming `listing_locations.phone` does not grant the request's viewer, for every caller, a `directory.listings.manage` key included."},"hours":{"type":["object","null"],"additionalProperties":{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"},"closed":{"type":"boolean"}}}},"is_primary":{"type":"boolean"}},"required":["id","name","address_line_1","address_line_2","city","state","postcode","country","latitude","longitude","phone","hours","is_primary"]}},"rating_breakdown":{"type":["object","null"],"properties":{"1":{"type":"number"},"2":{"type":"number"},"3":{"type":"number"},"4":{"type":"number"},"5":{"type":"number"}},"required":["1","2","3","4","5"]},"achievements":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["badge","certificate"]},"id":{"type":"string"},"name":{"type":["string","null"]},"color":{"type":["string","null"]},"image_url":{"type":["string","null"]},"course_title":{"type":"string"},"course_slug":{"type":"string"},"cpd_points":{"type":"number"},"earned_at":{"type":"string","format":"date-time"}},"required":["type","id","name","color","image_url","course_title","course_slug","cpd_points","earned_at"]}},"accepts_enquiries":{"type":"boolean","description":"Present on `GET /v1/directory/listings/{slugOrId}` only. True when the listing has an email address and the organisation is live, so `POST /v1/directory/listings/{slugOrId}/enquiries` can deliver an enquiry. The address itself is never returned."},"enquiry_terms_url":{"type":["string","null"],"description":"Present on `GET /v1/directory/listings/{slugOrId}` only. The organisation's listing contact terms link, or null when it requires none. When set, an enquiry must send `terms_accepted: true`."}},"required":["id","slug","name","short_description","logo_url","hero_image_url","is_featured","sponsor_level","average_rating","review_count","primary_category","primary_location","badges","topics","custom_fields","updated_at","description","phone","website","facebook_url","instagram_url","twitter_url","linkedin_url","youtube_url","business_hours","gallery_images","meta_title","meta_description","categories","tags","locations","rating_breakdown"]},"DirectoryListingDeleted":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]},"Category":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"parent_id":{"type":["string","null"],"format":"uuid"},"is_active":{"type":"boolean"}},"required":["id","account_id","name","slug","parent_id","is_active"]},"DirectoryListingCard":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"short_description":{"type":["string","null"]},"logo_url":{"type":["string","null"]},"hero_image_url":{"type":["string","null"]},"is_featured":{"type":"boolean"},"sponsor_level":{"type":"number"},"average_rating":{"type":["number","null"]},"review_count":{"type":"number"},"primary_category":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]},"primary_location":{"type":["object","null"],"properties":{"city":{"type":["string","null"]},"state":{"type":["string","null"]}},"required":["city","state"]},"badges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"icon":{"type":["string","null"]},"color":{"type":["string","null"]}},"required":["id","name","slug","icon","color"]}},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}},"custom_fields":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/PublicDirectoryCustomFieldResolved"},{"$ref":"#/components/schemas/PublicDirectoryCustomFieldGate"}]},"description":"The card custom fields the caller may see, each as a resolved value or a gate. With `fields`, only the named fields that are active and shown on cards, in the same form; an empty `fields` returns an empty array."},"updated_at":{"type":"string","format":"date-time","description":"When the listing was last updated, as an ISO 8601 timestamp with offset. The same for every caller."},"locations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"address_line_1":{"type":["string","null"]},"address_line_2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postcode":{"type":["string","null"]},"country":{"type":["string","null"]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"is_primary":{"type":"boolean"}},"required":["id","name","address_line_1","address_line_2","city","state","postcode","country","latitude","longitude","is_primary"]},"description":"Every location the listing has, with its public address and coordinates, for placing the listing on a map. `latitude` and `longitude` are null for a location that has not been geocoded."},"distance_km":{"type":["number","null"],"description":"Kilometres from the searched point to the listing's nearest location that has coordinates, rounded to two decimal places. It is the distance `sortBy=distance` orders by, which sorts on the unrounded value, so two listings can show the same rounded distance. Present only when the search includes a location (finite `lat`, `lng` and `radius`, or `filters.location`); null otherwise, and null for a listing with no geocoded location."},"selected_location_id":{"type":["string","null"],"format":"uuid","description":"The id of the location this card presents when it shows one: for a search that includes a location (finite `lat`, `lng` and `radius`, or `filters.location`), the listing's nearest location that has coordinates, or its primary location when none has coordinates; otherwise its primary location. A listing with no location marked primary falls back to its earliest-created location, so this is non-null whenever the listing has a location. It identifies an entry in `locations` by `id`. Null for a listing with no locations."},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"parent_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","parent_id"]},"description":"Present only when `include` carries `categories`: every active category linked to the listing, ordered by name, and an empty array for a listing with none. A parent category is named by `parent_id` only; read the category tree from `GET /v1/directory/categories` for its name."},"phone":{"type":["string","null"],"description":"Present only when `include` carries `phone`: the listing's public phone. Null when the listing has none, when the organisation hides phone in its directory form settings, or when an active field group withholds the listing phone from public visitors. A member bearer token never unmasks it. Never a per-location phone."}},"required":["id","slug","name","short_description","logo_url","hero_image_url","is_featured","sponsor_level","average_rating","review_count","primary_category","primary_location","badges","topics","custom_fields","updated_at","locations","distance_km","selected_location_id"]},"DirectorySearchResult":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DirectoryListingCard"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"DirectorySearchResultPost":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DirectoryListingCard"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"DirectoryMapMarker":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"logo_url":{"type":["string","null"]},"primary_category":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"average_rating":{"type":["number","null"]},"review_count":{"type":"number"},"locations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"],"description":"The listing location's name, as on the search card's `locations`. Null for a location with no name."},"address_line_1":{"type":["string","null"]},"address_line_2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postcode":{"type":["string","null"]},"country":{"type":["string","null"]},"latitude":{"type":"number"},"longitude":{"type":"number"},"is_primary":{"type":"boolean"}},"required":["id","name","address_line_1","address_line_2","city","state","postcode","country","latitude","longitude","is_primary"]},"description":"The listing's geocoded locations, one pin each. A location without coordinates is omitted, so a listing whose locations are all ungeocoded has an empty array."},"distance_km":{"type":["number","null"],"description":"Kilometres from the searched point to the listing's nearest geocoded location, rounded to two decimal places, as on the search card. Present only when the request includes a location (finite `lat`, `lng` and `radius`); null otherwise."}},"required":["id","slug","name","logo_url","primary_category","average_rating","review_count","locations","distance_km"]},"DirectoryMapPoint":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The listing name: a pin's hover title and accessible name, as on the map marker."},"locations":{"type":"array","items":{"type":"object","properties":{"latitude":{"type":"number"},"longitude":{"type":"number"}},"required":["latitude","longitude"]},"description":"The coordinates of each of the listing's geocoded locations, one pin each, in the same order as the listing's map marker `locations`. Coordinates are at their stored precision, so a pin sits exactly where the map marker's pin for the same location sits."}},"required":["id","name","locations"]},"DirectoryGeocodeResult":{"type":"object","properties":{"latitude":{"type":"number"},"longitude":{"type":"number"},"display_name":{"type":["string","null"],"description":"The geocoder's full name for the place it matched. Null when the point came from the durable geocode cache, which keeps coordinates only."}},"required":["latitude","longitude","display_name"]},"DirectoryMapSettings":{"type":"object","properties":{"default_location":{"type":["object","null"],"properties":{"latitude":{"type":"number"},"longitude":{"type":"number"}},"required":["latitude","longitude"],"description":"The account's configured map centre, or null when none is configured."},"listing_bounds":{"type":["object","null"],"properties":{"north":{"type":"number"},"south":{"type":"number"},"east":{"type":"number"},"west":{"type":"number"}},"required":["north","south","east","west"],"description":"The envelope of every publicly visible, geocoded location the account's listings have (every location a marker can pin), padded by 10% (at least 0.005 degrees) so no pin sits on the edge. Null when there are none."},"geocoding_available":{"type":"boolean","description":"Whether the account holds the directory.geocoding feature, so `GET /v1/directory/geocode` will resolve addresses for it."}},"required":["default_location","listing_bounds","geocoding_available"]},"DirectoryReview":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"listing_id":{"type":"string","format":"uuid"},"rating":{"type":"number","minimum":1,"maximum":5},"reviewer_name":{"type":"string"},"content":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected","flagged"]},"is_verified":{"type":"boolean"},"helpful_count":{"type":"number"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"is_mine":{"type":"boolean","description":"Optional-identity enrichment (Decision 2.10, SPEC-CORE-20260722 US-2.2 AC3): present when the caller supplies a valid member bearer token — true when the review is the member's own (matched by email). reviewer_email itself is never exposed. Absent for anonymous callers."}},"required":["id","account_id","listing_id","rating","reviewer_name","content","status","is_verified","helpful_count","created_at","updated_at"]},"DirectoryReviewList":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DirectoryReview"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"DirectoryEnquirySent":{"type":"object","properties":{"status":{"type":"string","enum":["sent"]}},"required":["status"]},"DirectoryMyListingUpdate":{"type":"object","properties":{"dms_open":{"type":"boolean"}},"required":["dms_open"]},"DirectoryFacetsMap":{"type":"object","additionalProperties":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["multiselect","dropdown"]},"label":{"type":"string"},"values":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"value":{"type":"string"},"label":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["value","label"]}}},"required":["type","label","values"]},{"type":"object","properties":{"type":{"type":"string","enum":["number"]},"label":{"type":"string"},"min":{"type":["number","null"]},"max":{"type":["number","null"]},"presets":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","description":"The bracket's display label, for example `Under 10,000`."},"min":{"type":"number","description":"Inclusive lower bound. Omitted when the bracket has no lower limit."},"max":{"type":"number","description":"Inclusive upper bound. Omitted when the bracket has no upper limit."}},"required":["label"]},"description":"Ordered preset brackets the account has configured on this field's number range filter, in display order. Each is a ready-made `custom_fields[<key>][min]` and `[max]` pair. A caller applies one at a time and may offer its own brackets instead. Omitted when the filter has none, so its absence means no presets rather than an empty list. Presets are static configuration: they do not depend on the caller's entitlement, and they are only ever returned inside this entry, which a caller who cannot read the field never receives."}},"required":["type","label","min","max"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"label":{"type":"string"},"min":{"type":["string","null"]},"max":{"type":["string","null"]}},"required":["type","label","min","max"]},{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"component":{"type":"string","enum":["city","state","postcode","country"]},"label":{"type":"string"},"values":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"value":{"type":"string"},"label":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["value","label"]}}},"required":["id","component","label","values"]}}]}},"DirectoryExportReportSummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":["string","null"]},"audience":{"type":"string","enum":["anonymous","members_only","restricted"]},"parameters":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"field":{"type":"string"}},"required":["name","field"]}}},"required":["id","name","description","audience","parameters"]},"DirectoryExportReportDenial":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string","enum":["sign_in_required","membership_required","entitlement_required"],"description":"Why the report was refused: `sign_in_required` (no session identified the caller, so signing in may grant access), `membership_required` (the caller is signed in but is not a contact of this organisation), `entitlement_required` (the caller is a contact of this organisation but holds neither a listed entitlement nor a listed segment). The audience, entitlement keys and segment ids that gated the report are never disclosed."},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]},"Contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"user_id":{"type":["string","null"],"format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"full_name":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"]},"company":{"type":["string","null"]},"primary_company_id":{"type":["string","null"],"format":"uuid"},"primary_company_name":{"type":["string","null"]},"job_title":{"type":["string","null"]},"website":{"type":["string","null"],"description":"The contact's own website, an http:// or https:// address. Null when none is set. Staff edit it on the contact record and a member edits it in the portal."},"status":{"type":"string"},"engagement_score":{"type":"number"},"tags":{"type":"array","items":{"type":"string"}},"custom_fields":{"type":"object","additionalProperties":{}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","user_id","first_name","last_name","full_name","email","phone","company","primary_company_id","primary_company_name","job_title","website","status","engagement_score","tags","custom_fields","created_at","updated_at"]},"ContactMeResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Contact"}},"required":["success","data"]},"MyContactUpdated":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Contact"}},"required":["success","data"]},"TeamMember":{"type":"object","properties":{"seat_id":{"type":["string","null"],"format":"uuid"},"invitation_id":{"type":["string","null"],"format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"role":{"type":"string","enum":["admin","member"]},"status":{"type":"string","enum":["invited","active","disabled"]},"joined_at":{"type":"string","format":"date-time"}},"required":["seat_id","invitation_id","contact_id","first_name","last_name","email","role","status","joined_at"]},"TeamWithSelf":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/TeamMember"}},"self":{"type":["object","null"],"properties":{"corporate_membership_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","member"]},"tier_id":{"type":"string","format":"uuid"},"tier_name":{"type":"string"},"company_id":{"type":["string","null"],"format":"uuid"},"company_name":{"type":["string","null"]},"max_seats":{"type":["integer","null"],"description":"Tier seat allowance. Null means unlimited."},"max_seats_effective":{"type":["integer","null"],"description":"Seat cap allowance: max_seats plus purchased extra seats. Null means unlimited."},"seats_used":{"type":"integer","description":"Committed seats: every seat row whatever its status, plus live pending invitations. Compare with max_seats_effective."},"is_holder":{"type":"boolean"}},"required":["corporate_membership_id","role","tier_id","tier_name","company_id","company_name","max_seats","max_seats_effective","seats_used","is_holder"],"description":"The caller's own seat context. Null when the caller has no corporate membership."}},"required":["members","self"]},"MyTeamResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/TeamWithSelf"}},"required":["success","data"]},"InviteTeamMemberResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/TeamMember"}},"required":["success","data"]},"InviteTeamMemberBody":{"type":"object","properties":{"email":{"type":"string","maxLength":255,"format":"email"},"first_name":{"type":"string","minLength":1,"maxLength":200},"last_name":{"type":"string","minLength":1,"maxLength":200},"job_title":{"type":"string","maxLength":200},"role":{"type":"string","enum":["admin","member"]}},"required":["email","first_name","last_name"]},"UpdateTeamMemberResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/TeamMember"}},"required":["success","data"]},"UpdateTeamMemberBody":{"type":"object","properties":{"role":{"type":"string","enum":["admin","member"]},"status":{"type":"string","enum":["invited","active","disabled"]}}},"TeamMutationStatus":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"]},"RemoveTeamMemberResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/TeamMutationStatus"}},"required":["success","data"]},"ResendInviteResult":{"type":"object","properties":{"status":{"type":"string","enum":["resent"]},"invitation_id":{"type":"string","format":"uuid"},"email_sent":{"type":"boolean"},"email_error_code":{"type":"string","enum":["INVITE_EMAIL_NOT_CONFIGURED","EMAIL_DELIVERY_FAILED"]}},"required":["status","invitation_id","email_sent"]},"ResendInviteResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ResendInviteResult"}},"required":["success","data"]},"CpdExportLog":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"date_range":{"type":"string"},"format":{"type":"string","enum":["pdf","csv","json"]},"course_count":{"type":"integer","minimum":0},"total_points":{"type":"number","minimum":0},"created_at":{"type":"string","format":"date-time"}},"required":["id","contact_id","date_range","format","course_count","total_points","created_at"]},"LogCpdExportResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CpdExportLog"}},"required":["success","data"]},"LogCpdExportBody":{"type":"object","properties":{"date_range":{"type":"string","minLength":1,"maxLength":120},"format":{"type":"string","enum":["pdf","csv","json"]},"course_count":{"type":"integer","minimum":0},"total_points":{"type":"number","minimum":0}},"required":["date_range","format","course_count","total_points"]},"Transaction":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"membership_id":{"type":["string","null"],"format":"uuid"},"order_number":{"type":"string"},"order_type":{"type":"string","enum":["membership","course","event","order","refund"]},"status":{"type":"string","enum":["pending","completed","cancelled","failed"]},"payment_status":{"type":"string","enum":["unpaid","paid","refunded"]},"subtotal_cents":{"type":"integer","description":"Net amount in cents, exclusive of tax: `total_cents` less `tax_cents`."},"discount_cents":{"type":"integer","description":"Discount in cents, already reflected in `total_cents`. Informational: it is not a term in the net, tax, gross triple."},"tax_cents":{"type":"integer","description":"GST component contained WITHIN `total_cents`, never an addition to it. Under the Australian GST-inclusive regime the catalogue price already contains the tax, so this figure is carved out of the gross rather than added to it. Zero when the organisation is not GST-registered, when every line is GST-free or input-taxed, and on orders created before tax at source shipped (historical orders are not backfilled)."},"total_cents":{"type":"integer","description":"Gross amount in cents the member pays, GST-inclusive. `subtotal_cents` plus `tax_cents` equals `total_cents`."},"currency":{"type":"string"},"description":{"type":["string","null"]},"metadata":{"type":["object","null"],"additionalProperties":{}},"paid_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","contact_id","membership_id","order_number","order_type","status","payment_status","subtotal_cents","discount_cents","tax_cents","total_cents","currency","description","metadata","paid_at","created_at","updated_at"]},"MyTransactionsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Transaction"}}},"required":["success","data"]},"TransferableColleagues":{"type":"object","properties":{"can_transfer":{"type":"boolean"},"colleagues":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":["string","null"],"format":"email"}},"required":["id","first_name","last_name","email"]}}},"required":["can_transfer","colleagues"]},"TransferableColleaguesResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/TransferableColleagues"}},"required":["success","data"]},"ContactTeamResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/TeamMember"}}},"required":["success","data"]},"Statement":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"expires_at":{"type":"string","format":"date-time"},"year":{"type":"integer"},"generated_at":{"type":"string","format":"date-time"}},"required":["url","expires_at","year","generated_at"]},"StatementResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Statement"}},"required":["success","data"]},"GenerateStatementBody":{"type":"object","properties":{"year":{"type":"integer","minimum":2000,"maximum":2100,"description":"The year the period ends. When omitted, a calendar statement covers the current calendar year and a financial-year statement covers the last complete financial year, both read in the organisation's timezone."},"period":{"type":"string","enum":["calendar","financial_year"],"default":"calendar","description":"calendar (the default) covers 1 January to 31 December of year. financial_year covers the organisation's financial year, whose start month each organisation sets; year is the year it ends, so with a July start 2026 covers 1 July 2025 to 30 June 2026. When year is omitted, calendar uses the current calendar year and financial_year uses the last complete financial year, read in the organisation's timezone. Either period runs from midnight at the start of its first day up to, but not including, midnight after its last day, in the organisation's timezone."}}},"InvoiceUrl":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"]},"InvoiceUrlResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/InvoiceUrl"}},"required":["success","data"]},"ConnectedProfile":{"type":"object","properties":{"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"user_id":{"type":["string","null"],"format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"full_name":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"]},"company":{"type":["string","null"]},"primary_company_id":{"type":["string","null"],"format":"uuid"},"primary_company_name":{"type":["string","null"]},"job_title":{"type":["string","null"]},"website":{"type":["string","null"],"description":"The contact's own website, an http:// or https:// address. Null when none is set. Staff edit it on the contact record and a member edits it in the portal."},"status":{"type":"string"},"engagement_score":{"type":"number"},"tags":{"type":"array","items":{"type":"string"}},"custom_fields":{"type":"object","additionalProperties":{}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","user_id","first_name","last_name","full_name","email","phone","company","primary_company_id","primary_company_name","job_title","website","status","engagement_score","tags","custom_fields","created_at","updated_at"]},"directory":{"type":["object","null"],"properties":{"slug":{"type":"string"},"listing_name":{"type":"string"},"is_verified":{"type":"boolean"},"logo_url":{"type":["string","null"]},"show_badges":{"type":"boolean"},"show_certificates":{"type":"boolean"}},"required":["slug","listing_name","is_verified","logo_url","show_badges","show_certificates"]},"lms":{"type":["object","null"],"properties":{"enrollments_count":{"type":"integer","minimum":0},"courses_completed":{"type":"integer","minimum":0},"total_cpd_points":{"type":"number","minimum":0},"badges":{"type":"array","items":{"type":"object","properties":{"badge_name":{"type":"string"},"badge_color":{"type":"string"},"course_title":{"type":"string"},"course_slug":{"type":"string"},"earned_at":{"type":"string","format":"date-time"}},"required":["badge_name","badge_color","course_title","course_slug","earned_at"]}},"certificates":{"type":"array","items":{"type":"object","properties":{"course_title":{"type":"string"},"course_slug":{"type":"string"},"certificate_number":{"type":"string"},"verification_code":{"type":"string"},"cpd_points":{"type":"number"},"issued_at":{"type":"string","format":"date-time"}},"required":["course_title","course_slug","certificate_number","verification_code","cpd_points","issued_at"]}},"cpd_resolution":{"type":"string","enum":["resolved","not_configured","failed","not_applicable"]},"cpd":{"type":["object","null"],"properties":{"standard_target":{"type":["number","null"]},"effective_target":{"type":["number","null"]},"adjustment":{"type":["object","null"],"properties":{"reason_code":{"type":["string","null"]},"reason_label":{"type":["string","null"]},"type":{"type":"string","enum":["auto_prorata","manual_override","switch","crm_derived","crm_synced"]},"note":{"type":"string"}},"required":["reason_code","reason_label","type","note"]},"status":{"type":["string","null"],"enum":["met","on_track","behind"]},"period_end":{"type":["string","null"]},"days_remaining":{"type":["integer","null"]},"earned":{"type":"number"}},"required":["standard_target","effective_target","adjustment","status","period_end","days_remaining","earned"]}},"required":["enrollments_count","courses_completed","total_cpd_points","badges","certificates","cpd_resolution","cpd"]},"events":{"type":["object","null"],"properties":{"attended":{"type":"array","items":{"type":"object","properties":{"event_id":{"type":"string","format":"uuid"},"event_title":{"type":"string"},"event_slug":{"type":"string"},"date":{"type":"string","format":"date-time"},"venue":{"type":["string","null"]},"status":{"type":"string"}},"required":["event_id","event_title","event_slug","date","venue","status"]}},"upcoming":{"type":"array","items":{"type":"object","properties":{"event_id":{"type":"string","format":"uuid"},"event_title":{"type":"string"},"event_slug":{"type":"string"},"date":{"type":"string","format":"date-time"},"venue":{"type":["string","null"]},"status":{"type":"string"}},"required":["event_id","event_title","event_slug","date","venue","status"]}},"total_attended":{"type":"integer","minimum":0},"total_registered":{"type":"integer","minimum":0}},"required":["attended","upcoming","total_attended","total_registered"]},"activity":{"type":"object","properties":{"engagement_score":{"type":"number"},"summary":{"type":["object","null"],"properties":{"lms":{"type":"object","properties":{"enrollments":{"type":"integer","minimum":0},"completions":{"type":"integer","minimum":0}},"required":["enrollments","completions"]},"loop":{"type":"object","properties":{"posts":{"type":"integer","minimum":0},"reactions":{"type":"integer","minimum":0}},"required":["posts","reactions"]},"events":{"type":"object","properties":{"registrations":{"type":"integer","minimum":0},"attended":{"type":"integer","minimum":0}},"required":["registrations","attended"]}},"required":["lms","loop","events"]}},"required":["engagement_score","summary"]}},"required":["contact","directory","lms","events","activity"]},"MyConnectedProfileResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ConnectedProfile"}},"required":["success","data"]},"ContactListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"ContactDeleteBlocker":{"type":"object","properties":{"resource_type":{"type":"string"},"count":{"type":"integer","exclusiveMinimum":0}},"required":["resource_type","count"]},"BulkContactsOperationResult":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"method":{"type":"string","enum":["create","update","delete"]},"id":{"type":"string","format":"uuid"},"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/Contact"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","properties":{"blockers":{"type":"array","items":{"$ref":"#/components/schemas/ContactDeleteBlocker"},"minItems":1}},"required":["blockers"]}},"required":["code","message"]}},"required":["index","method","success"]},"BulkContactsResult":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"succeeded":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"results":{"type":"array","items":{"$ref":"#/components/schemas/BulkContactsOperationResult"}}},"required":["total","succeeded","failed","results"]},"BulkContactsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/BulkContactsResult"}},"required":["success","data"]},"BulkContactOperation":{"oneOf":[{"type":"object","properties":{"method":{"type":"string","enum":["create"]},"data":{"type":"object","properties":{"first_name":{"type":"string","minLength":1,"maxLength":200},"last_name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":50},"company":{"type":["string","null"],"maxLength":200},"job_title":{"type":["string","null"],"maxLength":200},"website":{"type":["string","null"],"maxLength":2048,"description":"The contact's own website. Must start with http:// or https:// (any other scheme is refused with 400) and be at most 2048 characters. An empty string or null clears it."},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":50},"primary_company_id":{"type":["string","null"],"format":"uuid"},"custom_fields":{"type":"object","additionalProperties":{}},"external_source":{"type":"string","minLength":1,"maxLength":64},"external_id":{"type":"string","minLength":1,"maxLength":255}},"required":["first_name","last_name"]}},"required":["method","data"]},{"type":"object","properties":{"method":{"type":"string","enum":["update"]},"id":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"first_name":{"type":"string","minLength":1,"maxLength":200},"last_name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":50},"company":{"type":["string","null"],"maxLength":200},"job_title":{"type":["string","null"],"maxLength":200},"website":{"type":["string","null"],"maxLength":2048,"description":"The contact's own website. Must start with http:// or https:// (any other scheme is refused with 400) and be at most 2048 characters. An empty string or null clears it."},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":50},"primary_company_id":{"type":["string","null"],"format":"uuid"},"custom_fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["active","pending","lapsed","expired","cancelled"]}}}},"required":["method","id","data"]},{"type":"object","properties":{"method":{"type":"string","enum":["delete"]},"id":{"type":"string","format":"uuid"}},"required":["method","id"]}]},"BulkContactsRequest":{"type":"object","properties":{"operations":{"type":"array","items":{"$ref":"#/components/schemas/BulkContactOperation"},"minItems":1,"maxItems":100}},"required":["operations"]},"ContactSearchResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}}},"required":["success","data"]},"ContactAddress":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"color":{"type":["string","null"]}},"required":["id","name","slug","color"]},"name":{"type":["string","null"]},"address_line_1":{"type":["string","null"]},"address_line_2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postcode":{"type":["string","null"]},"country":{"type":["string","null"]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]}},"required":["id","type","name","address_line_1","address_line_2","city","state","postcode","country","latitude","longitude"]},"ContactDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"user_id":{"type":["string","null"],"format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"full_name":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"]},"company":{"type":["string","null"]},"primary_company_id":{"type":["string","null"],"format":"uuid"},"primary_company_name":{"type":["string","null"]},"job_title":{"type":["string","null"]},"website":{"type":["string","null"],"description":"The contact's own website, an http:// or https:// address. Null when none is set. Staff edit it on the contact record and a member edits it in the portal."},"status":{"type":"string"},"engagement_score":{"type":"number"},"tags":{"type":"array","items":{"type":"string"}},"custom_fields":{"type":"object","additionalProperties":{}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/ContactAddress"},"description":"The contact's structured addresses, ordered by their address type's display order. Each carries its type; the type describes what kind of place the address is, never what it is used for."},"billing_address_id":{"type":["string","null"],"format":"uuid","description":"The contact's billing address: the address matching the type this organisation configured as its contact billing default, or, when the contact holds none, their postal address (the system Postal type, where it applies to contacts and holds one address per contact). Companies have no such fallback. Reflects the configured default and is a convenience, not a constraint: a consumer holding its own billing-field rule can ignore it and select from `addresses` by `type.slug`. Null when the contact holds neither a billing default address nor a postal address."},"correspondence_address_id":{"type":["string","null"],"format":"uuid","description":"The highest-priority address type the contact actually holds, per the organisation's configured address type order. Reflects that configured default and is a convenience, not a constraint. Null when the contact holds no address of a usable type."},"deletion_impact":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"dependencies":{"type":"array","items":{"type":"object","properties":{"constraint":{"type":"string"},"relation":{"type":"string"},"columns":{"type":"array","items":{"type":"string"}},"contact_columns":{"type":"array","items":{"type":"string"}},"action":{"type":"string","enum":["cascade","set_null","set_default","restrict","no_action"]},"count":{"type":"integer","minimum":0}},"required":["constraint","relation","columns","contact_columns","action","count"]}}},"required":["contact_id","dependencies"]}},"required":["id","account_id","user_id","first_name","last_name","full_name","email","phone","company","primary_company_id","primary_company_name","job_title","website","status","engagement_score","tags","custom_fields","created_at","updated_at","addresses","billing_address_id","correspondence_address_id"]},"DeleteContactResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]}},"required":["success","data"]},"ContactHasDependentsError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string","enum":["CONTACT_HAS_DEPENDENTS"]},"message":{"type":"string"},"details":{"type":"object","properties":{"blockers":{"type":"array","items":{"$ref":"#/components/schemas/ContactDeleteBlocker"},"minItems":1}},"required":["blockers"]}},"required":["code","message","details"]}},"required":["success","error"]},"Company":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"legal_name":{"type":["string","null"]},"display_name":{"type":["string","null"]},"slug":{"type":["string","null"]},"classification":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"color":{"type":["string","null"]}},"required":["id","name","slug","color"]},"industry":{"type":["string","null"]},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"]},"website":{"type":["string","null"]},"domain":{"type":["string","null"]},"country":{"type":["string","null"],"description":"Sourced from the company's Main address (the flat company address block is retired). Null when the company holds no Main address."},"status":{"type":"string"},"lifecycle_stage":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","name","legal_name","display_name","slug","classification","industry","email","phone","website","domain","country","status","lifecycle_stage","tags","created_at","updated_at"]},"CompanyListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Company"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"CompanyAddress":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"color":{"type":["string","null"]}},"required":["id","name","slug","color"]},"name":{"type":["string","null"]},"address_line_1":{"type":["string","null"]},"address_line_2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"postcode":{"type":["string","null"]},"country":{"type":["string","null"]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"phone":{"type":["string","null"]},"phone_dial_code":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","type","name","address_line_1","address_line_2","city","state","postcode","country","latitude","longitude","phone","phone_dial_code","email"]},"CompanyDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"legal_name":{"type":["string","null"]},"display_name":{"type":["string","null"]},"slug":{"type":["string","null"]},"classification":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"color":{"type":["string","null"]}},"required":["id","name","slug","color"]},"industry":{"type":["string","null"]},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"]},"website":{"type":["string","null"]},"domain":{"type":["string","null"]},"country":{"type":["string","null"]},"status":{"type":"string"},"lifecycle_stage":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/CompanyAddress"},"description":"The company's structured addresses, ordered by their address type's display order. Each carries its type; the type describes what kind of place the address is, never what it is used for."},"billing_address_id":{"type":["string","null"],"format":"uuid","description":"The address matching the type this organisation configured as its company billing default. Reflects that configured default and is a convenience, not a constraint: a consumer holding its own billing-field rule can ignore it and select from `addresses` by `type.slug`. Null when no type holds the role, or the company holds no address of it."},"correspondence_address_id":{"type":["string","null"],"format":"uuid","description":"The highest-priority address type the company actually holds, per the organisation's configured address type order. Reflects that configured default and is a convenience, not a constraint. Null when the company holds no address of a usable type."}},"required":["id","account_id","name","legal_name","display_name","slug","classification","industry","email","phone","website","domain","country","status","lifecycle_stage","tags","created_at","updated_at","addresses","billing_address_id","correspondence_address_id"]},"DeleteCompanyResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]}},"required":["success","data"]},"SignupField":{"type":"object","properties":{"field_key":{"type":"string"},"name":{"type":"string"},"field_type":{"type":"string","enum":["text","paragraph","number","email","phone","url","date","datetime","select","multi_select","checkbox","checkbox_group","radio","toggle","array","item_list","file","image"]},"description":{"type":["string","null"]},"options":{"type":["array","null"],"items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"validation_rules":{"type":["object","null"],"properties":{"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"},"message":{"type":"string"}}},"help_text":{"type":["string","null"]},"placeholder":{"type":["string","null"]},"default_value":{"type":["string","null"]},"is_required":{"type":"boolean"},"sort_order":{"type":"number"},"group_id":{"type":["string","null"],"format":"uuid"},"group_name":{"type":["string","null"]},"group_sort_order":{"type":["number","null"]}},"required":["field_key","name","field_type","description","options","validation_rules","help_text","placeholder","default_value","is_required","sort_order","group_id","group_name","group_sort_order"]},"Tier":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"tier_type":{"type":"string"},"max_seats":{"type":["number","null"]},"price_cents":{"type":"number","description":"Base tier price in cents. Catalogue prices are GST-inclusive: what the buyer pays. GST is carved out of the amount when the order is created, never added to it at checkout."},"billing_period":{"type":["string","null"]},"renewal_basis":{"type":"string"},"late_join_policy":{"type":"string","enum":["standard","full_fee_rollover","prorata_plus_next_period"],"description":"How a person joining late in an annual fixed-date period is charged on their first membership with the organisation: `standard` (current period only) or `full_fee_rollover` (one full fee inside the late joining window, covering the following period). `prorata_plus_next_period` is reserved."},"late_join_rollover_months":{"type":["integer","null"],"description":"The late joining window in months before a fixed-date renewal, or null when late_join_policy is standard."},"grace_period_days":{"type":"number"},"grace_access":{"type":"string","enum":["keep","remove"],"description":"Whether members keep access during the grace period (`keep`) or lose what a lapse removes from the paid-to date until the renewal is paid or staff restore access (`remove`)."},"reinstatement_policy":{"type":"string","enum":["current_period","fresh_term"],"description":"Where the term of a returning member starts when they pay to rejoin: `current_period` (their own renewal cycle, advanced past the payment date) or `fresh_term` (a new term from the payment date, anniversary tiers only). A fixed-date tier always continues on its fixed renewal date."},"benefits":{"type":"array","items":{"type":"string"}},"app_access":{"type":"object","additionalProperties":{"type":"string"}},"is_active":{"type":"boolean"},"is_default":{"type":"boolean"},"sort_order":{"type":"number"},"seat_pricing_mode":{"type":"string","enum":["fixed","graduated","volume"]},"seat_price_cents":{"type":["number","null"],"description":"Per-seat price in cents for fixed seat pricing. Catalogue prices are GST-inclusive: what the buyer pays. GST is carved out of the amount when the order is created, never added to it at checkout."},"included_seats":{"type":["number","null"]},"currency":{"type":"string"},"seat_brackets":{"type":"array","items":{"type":"object","properties":{"bracket_order":{"type":"integer"},"up_to_seats":{"type":["integer","null"]},"unit_price_cents":{"type":"integer","description":"Per-seat price in cents within this bracket. Catalogue prices are GST-inclusive: what the buyer pays. GST is carved out of the amount when the order is created, never added to it at checkout."}},"required":["bracket_order","up_to_seats","unit_price_cents"]}},"formatted_price":{"type":"string"},"member_count":{"type":"number","description":"Memberships on this tier that are active or in grace, because a member in grace is a member. Present only when includeMemberCounts is true. The status-exact active count is active_membership_count on the tier detail."},"created_at":{"type":"string","format":"date-time"}},"required":["id","account_id","name","slug","description","tier_type","max_seats","price_cents","billing_period","renewal_basis","late_join_policy","late_join_rollover_months","grace_period_days","grace_access","reinstatement_policy","benefits","app_access","is_active","is_default","sort_order","seat_pricing_mode","seat_price_cents","included_seats","currency","seat_brackets","formatted_price","created_at"]},"TierDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"tier_type":{"type":"string"},"max_seats":{"type":["number","null"]},"price_cents":{"type":"number","description":"Base tier price in cents. Catalogue prices are GST-inclusive: what the buyer pays. GST is carved out of the amount when the order is created, never added to it at checkout."},"billing_period":{"type":["string","null"]},"renewal_basis":{"type":"string"},"late_join_policy":{"type":"string","enum":["standard","full_fee_rollover","prorata_plus_next_period"],"description":"How a person joining late in an annual fixed-date period is charged on their first membership with the organisation: `standard` (current period only) or `full_fee_rollover` (one full fee inside the late joining window, covering the following period). `prorata_plus_next_period` is reserved."},"late_join_rollover_months":{"type":["integer","null"],"description":"The late joining window in months before a fixed-date renewal, or null when late_join_policy is standard."},"grace_period_days":{"type":"number"},"grace_access":{"type":"string","enum":["keep","remove"],"description":"Whether members keep access during the grace period (`keep`) or lose what a lapse removes from the paid-to date until the renewal is paid or staff restore access (`remove`)."},"reinstatement_policy":{"type":"string","enum":["current_period","fresh_term"],"description":"Where the term of a returning member starts when they pay to rejoin: `current_period` (their own renewal cycle, advanced past the payment date) or `fresh_term` (a new term from the payment date, anniversary tiers only). A fixed-date tier always continues on its fixed renewal date."},"benefits":{"type":"array","items":{"type":"string"}},"app_access":{"type":"object","additionalProperties":{"type":"string"}},"is_active":{"type":"boolean"},"is_default":{"type":"boolean"},"sort_order":{"type":"number"},"seat_pricing_mode":{"type":"string","enum":["fixed","graduated","volume"]},"seat_price_cents":{"type":["number","null"],"description":"Per-seat price in cents for fixed seat pricing. Catalogue prices are GST-inclusive: what the buyer pays. GST is carved out of the amount when the order is created, never added to it at checkout."},"included_seats":{"type":["number","null"]},"currency":{"type":"string"},"seat_brackets":{"type":"array","items":{"type":"object","properties":{"bracket_order":{"type":"integer"},"up_to_seats":{"type":["integer","null"]},"unit_price_cents":{"type":"integer","description":"Per-seat price in cents within this bracket. Catalogue prices are GST-inclusive: what the buyer pays. GST is carved out of the amount when the order is created, never added to it at checkout."}},"required":["bracket_order","up_to_seats","unit_price_cents"]}},"formatted_price":{"type":"string"},"member_count":{"type":"number","description":"Memberships on this tier that are active or in grace, because a member in grace is a member. Present only when includeMemberCounts is true. The status-exact active count is active_membership_count on the tier detail."},"created_at":{"type":"string","format":"date-time"},"active_membership_count":{"type":"integer","minimum":0,"description":"Memberships on this tier whose status is active."},"pending_membership_count":{"type":"integer","minimum":0,"description":"Memberships on this tier whose status is pending."},"non_active_membership_count":{"type":"integer","minimum":0,"description":"Memberships on this tier whose status is not active, including pending memberships."},"blocking_membership_count":{"type":"integer","minimum":0,"description":"The total memberships blocking tier deletion because every membership reference is protected by an ON DELETE RESTRICT foreign key."}},"required":["id","account_id","name","slug","description","tier_type","max_seats","price_cents","billing_period","renewal_basis","late_join_policy","late_join_rollover_months","grace_period_days","grace_access","reinstatement_policy","benefits","app_access","is_active","is_default","sort_order","seat_pricing_mode","seat_price_cents","included_seats","currency","seat_brackets","formatted_price","created_at","active_membership_count","pending_membership_count","non_active_membership_count","blocking_membership_count"]},"DeleteTierResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]}},"required":["success","data"]},"MemberEntitlements":{"type":"object","properties":{"tier_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"is_member":{"type":"boolean"},"capabilities":{"type":"array","items":{"type":"object","properties":{"gate_key":{"type":"string"},"name":{"type":"string"},"granted_via":{"type":"array","items":{"type":"string","enum":["tier","direct"]},"minItems":1},"quantity_allowed":{"type":["integer","null"]},"quantity_remaining":{"type":["integer","null"]},"expires_at":{"type":["string","null"],"description":"ISO 8601 UTC instant at which the member stops holding this capability, or null. Null whenever ANY source grants it with no end: a membership tier or seat, or a direct grant without an expiry. When only time-bounded direct grants provide it, this is the LATEST of their expiry dates, since the member holds it until the last one lapses. Only grants that are live now are considered, so a past expiry never appears here. It reflects the grants alone: a tier-derived capability always reports null, even though the membership behind it can still lapse, which the membership events announce."}},"required":["gate_key","name","granted_via","quantity_allowed","quantity_remaining","expires_at"]}}},"required":["tier_ids","is_member","capabilities"]},"MyEntitlementsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/MemberEntitlements"}},"required":["success","data"]},"Membership":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":"string","format":"uuid"},"company_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","description":"Membership status: active, pending, grace, lapsed, expired, cancelled or renewed. grace is set only by the platform, for a membership on a tier that removes access during grace, and means access is removed until the renewal is paid or staff restore access."},"start_date":{"type":"string","format":"date-time"},"renewal_date":{"type":["string","null"],"format":"date-time"},"expiry_date":{"type":["string","null"],"format":"date-time"},"cancelled_at":{"type":["string","null"],"format":"date-time"},"cancellation_reason":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"days_until_renewal":{"type":["number","null"]},"via_seat":{"type":"boolean"}},"required":["id","contact_id","tier_id","company_id","status","start_date","renewal_date","expiry_date","cancelled_at","cancellation_reason","created_at","days_until_renewal","via_seat"]},"MyMembershipsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Membership"}}},"required":["success","data"]},"CheckoutSession":{"type":"object","properties":{"checkout_url":{"type":"string","format":"uri"},"external_id":{"type":"string"},"cart_id":{"type":"string","format":"uuid"},"expires_at":{"type":"string","format":"date-time"}},"required":["checkout_url","external_id","cart_id","expires_at"]},"CancelMembershipResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"status":{"type":"string","enum":["cancelled"]}},"required":["status"]}},"required":["success","data"]},"CorporateSeat":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"corporate_membership_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"status":{"type":"string"},"role":{"type":"string"},"added_at":{"type":"string","format":"date-time"}},"required":["id","account_id","corporate_membership_id","contact_id","status","role","added_at"]},"Deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"stage_id":{"type":"string","format":"uuid"},"deal_type_id":{"type":["string","null"],"format":"uuid"},"deal_number":{"type":"string"},"name":{"type":"string"},"value_cents":{"type":"integer"},"currency":{"type":"string"},"probability":{"type":["integer","null"],"minimum":0,"maximum":100},"expected_close_date":{"type":["string","null"]},"actual_close_date":{"type":["string","null"]},"description":{"type":["string","null"]},"status":{"type":"string","enum":["open","won","lost"]},"tags":{"type":"array","items":{"type":"string"}},"source":{"type":["string","null"]},"tier_id":{"type":["string","null"],"format":"uuid"},"order_id":{"type":["string","null"],"format":"uuid"},"owner_id":{"type":["string","null"],"format":"uuid"},"close_reason":{"type":["string","null"]},"competitor":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","contact_id","stage_id","deal_type_id","deal_number","name","value_cents","currency","probability","expected_close_date","actual_close_date","description","status","tags","source","tier_id","order_id","owner_id","close_reason","competitor","metadata","created_at","updated_at"]},"DealsListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Deal"}}},"required":["success","data"]},"CreateDealResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Deal"}},"required":["success","data"]},"CreateDealBody":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"stage_id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":200},"value_cents":{"type":"integer","minimum":0},"probability":{"type":["integer","null"],"minimum":0,"maximum":100},"expected_close_date":{"type":["string","null"]},"description":{"type":["string","null"],"maxLength":5000},"source":{"type":["string","null"],"maxLength":100},"tier_id":{"type":["string","null"],"format":"uuid"},"deal_type_id":{"type":["string","null"],"format":"uuid"},"owner_id":{"type":["string","null"],"format":"uuid"},"tags":{"type":"array","items":{"type":"string"},"maxItems":50},"metadata":{"type":"object","additionalProperties":{}}},"required":["contact_id","stage_id","name"]},"InboundLeadResult":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"deal_id":{"type":"string","format":"uuid"},"deduplicated":{"type":"boolean"}},"required":["contact_id","deal_id","deduplicated"]},"InboundLeadReturningResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/InboundLeadResult"}},"required":["success","data"]},"InboundLeadResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/InboundLeadResult"}},"required":["success","data"]},"InboundLeadAttributionTouch":{"type":["object","null"],"properties":{"market":{"type":"string","description":"Market edition that captured the lead, e.g. 'au' (Australian) or 'na' (North American). Accepted at any length; only the first 16 characters are stored."},"utm_source":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."},"utm_medium":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."},"utm_campaign":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."},"utm_content":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."},"utm_term":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."},"referrer":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."},"landing_page":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."},"gclid":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."},"li_fat_id":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."},"at":{"type":"string","description":"Accepted at any length; only the first 500 characters are stored."}},"description":"Campaign data for a single touch. Best-effort and never rejected: unlisted fields are ignored, values longer than 500 characters are truncated to 500, and a non-string value is dropped without affecting the other fields."},"InboundLeadQualification":{"type":"object","properties":{"intent":{"type":"string","description":"'booking' when the visitor went on to the calendar to pick a time (completion is not confirmed), 'enquiry' when they sent their details without booking. An unrecognised value is stored as sent. Accepted at any length; leading and trailing whitespace is trimmed and only the first 32 characters are stored."},"organisation":{"type":"string","description":"Organisation name. When present it names the deal in place of the email address. Accepted at any length; leading and trailing whitespace is trimmed and only the first 200 characters are stored."},"member_band":{"type":"string","description":"Membership size band: 'under-500', '500-2000', '2000-10000' or '10000-plus'. An unrecognised value is stored as sent. Accepted at any length; leading and trailing whitespace is trimmed and only the first 32 characters are stored."},"below_fit_floor":{"type":"boolean","description":"True when the organisation is below the ~500-member fit floor. Set by the sender. When true, the deal description starts with a fit-floor notice. A non-boolean value is dropped."},"current_system":{"type":"string","description":"Current membership system as a display label, e.g. 'Spreadsheets'. Accepted at any length; leading and trailing whitespace is trimmed and only the first 100 characters are stored."},"crm":{"type":"string","description":"Current CRM as a display label, e.g. 'None'. Accepted at any length; leading and trailing whitespace is trimmed and only the first 100 characters are stored."},"timeline":{"type":"string","description":"When they want to be live, as a display label, e.g. 'Within 6 months'. Accepted at any length; leading and trailing whitespace is trimmed and only the first 60 characters are stored."},"driver":{"type":"string","description":"Free text: what is prompting them to look now. Accepted at any length; leading and trailing whitespace is trimmed and only the first 1000 characters are stored."}},"description":"Fit answers from the website booking form. Stored under `metadata.qualification` on the deal created for a new lead, and on the timeline note for every capture, and rendered as readable lines in the note. Best-effort and never rejected: unlisted fields are ignored, a malformed field is dropped without affecting the others, a malformed object is discarded, and a qualification with no usable field is stored as null."},"InboundLeadBody":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"},"source":{"type":"string","minLength":1,"maxLength":100,"description":"Lead source slug, e.g. 'journey-canvas' (the default) or 'book-a-call'."},"market":{"type":"string","description":"Market edition that captured the lead, e.g. 'au' (Australian) or 'na' (North American). Stored as `metadata.market` on the deal and on the capture note. Falls back to `lastTouch.market`, then `firstTouch.market`, when omitted."},"need":{"type":"string","maxLength":200,"description":"What the lead was doing when captured, e.g. the mapped journey goal, or a one-line summary of booking-form answers."},"at":{"type":"string","maxLength":40},"first_name":{"type":"string","maxLength":100},"last_name":{"type":"string","maxLength":100},"attribution":{"type":"object","properties":{"firstTouch":{"$ref":"#/components/schemas/InboundLeadAttributionTouch"},"lastTouch":{"$ref":"#/components/schemas/InboundLeadAttributionTouch"}},"description":"First-touch and last-touch campaign data. Stored under `metadata.attribution` as `first_touch`/`last_touch` on the deal created for a new lead, and on the timeline note for every capture. Best-effort: malformed attribution is discarded rather than rejecting the lead."},"qualification":{"$ref":"#/components/schemas/InboundLeadQualification"}},"required":["email"]},"DealResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Deal"}},"required":["success","data"]},"UpdateDealResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Deal"}},"required":["success","data"]},"UpdateDealBody":{"type":"object","properties":{"stage_id":{"type":"string","format":"uuid"},"deal_type_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":200},"value_cents":{"type":"integer","minimum":0},"probability":{"type":["integer","null"],"minimum":0,"maximum":100},"expected_close_date":{"type":["string","null"]},"description":{"type":["string","null"],"maxLength":5000},"source":{"type":["string","null"],"maxLength":100},"tier_id":{"type":["string","null"],"format":"uuid"},"owner_id":{"type":["string","null"],"format":"uuid"},"tags":{"type":"array","items":{"type":"string"},"maxItems":50},"metadata":{"type":"object","additionalProperties":{}}}},"DeleteDealResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]}},"required":["success","data"]},"BulkDealsOperationResult":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"method":{"type":"string","enum":["create","update","delete"]},"id":{"type":"string","format":"uuid"},"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/Deal"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["index","method","success"]},"BulkDealsResult":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"succeeded":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"results":{"type":"array","items":{"$ref":"#/components/schemas/BulkDealsOperationResult"}}},"required":["total","succeeded","failed","results"]},"BulkDealsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/BulkDealsResult"}},"required":["success","data"]},"BulkDealOperation":{"oneOf":[{"type":"object","properties":{"method":{"type":"string","enum":["create"]},"data":{"$ref":"#/components/schemas/CreateDealBody"}},"required":["method","data"]},{"type":"object","properties":{"method":{"type":"string","enum":["update"]},"id":{"type":"string","format":"uuid"},"data":{"$ref":"#/components/schemas/UpdateDealBody"}},"required":["method","id","data"]},{"type":"object","properties":{"method":{"type":"string","enum":["delete"]},"id":{"type":"string","format":"uuid"}},"required":["method","id"]}]},"BulkDealsRequest":{"type":"object","properties":{"operations":{"type":"array","items":{"$ref":"#/components/schemas/BulkDealOperation"},"minItems":1,"maxItems":100}},"required":["operations"]},"CloseDealResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Deal"}},"required":["success","data"]},"CloseDealBody":{"type":"object","properties":{"status":{"type":"string","enum":["won","lost"]},"close_reason":{"type":["string","null"],"maxLength":500},"competitor":{"type":["string","null"],"maxLength":200},"actual_close_date":{"type":"string"}},"required":["status"]},"Task":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"deal_id":{"type":["string","null"],"format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"due_on":{"type":["string","null"],"format":"date"},"due_date":{"type":["string","null"],"format":"date-time"},"assigned_to":{"type":["string","null"],"format":"uuid"},"completed":{"type":"boolean"},"completed_at":{"type":["string","null"],"format":"date-time"},"completed_by":{"type":["string","null"],"format":"uuid"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"task_type":{"type":"string","enum":["call","email","meeting","follow_up","review","demo","proposal","other"]},"created_by":{"type":["string","null"],"format":"uuid"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","deal_id","contact_id","title","description","due_on","due_date","assigned_to","completed","completed_at","completed_by","priority","task_type","created_by","created_at","updated_at"]},"TasksListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Task"}}},"required":["success","data"]},"CreateTaskResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"}},"required":["success","data"]},"CreateTaskBody":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":["string","null"],"maxLength":5000},"due_on":{"type":["string","null"],"format":"date"},"due_date":{"type":["string","null"],"format":"date-time"},"assigned_to":{"type":["string","null"],"format":"uuid"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"task_type":{"type":"string","enum":["call","email","meeting","follow_up","review","demo","proposal","other"]},"contact_id":{"type":["string","null"],"format":"uuid"},"deal_id":{"type":["string","null"],"format":"uuid"}},"required":["title"]},"TaskResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"}},"required":["success","data"]},"UpdateTaskResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"}},"required":["success","data"]},"UpdateTaskBody":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":["string","null"],"maxLength":5000},"due_on":{"type":["string","null"],"format":"date"},"due_date":{"type":["string","null"],"format":"date-time"},"assigned_to":{"type":["string","null"],"format":"uuid"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"task_type":{"type":"string","enum":["call","email","meeting","follow_up","review","demo","proposal","other"]},"completed":{"type":"boolean"},"contact_id":{"type":["string","null"],"format":"uuid"},"deal_id":{"type":["string","null"],"format":"uuid"}}},"DeleteTaskResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]}},"required":["success","data"]},"DealActivity":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"deal_id":{"type":"string","format":"uuid"},"activity_type":{"type":"string","enum":["stage_change","note","value_change","created","won","lost","owner_change","probability_change","close_date_change","reopened"]},"title":{"type":"string"},"description":{"type":["string","null"]},"from_stage_id":{"type":["string","null"],"format":"uuid"},"to_stage_id":{"type":["string","null"],"format":"uuid"},"old_value_cents":{"type":["integer","null"]},"new_value_cents":{"type":["integer","null"]},"old_probability":{"type":["integer","null"]},"new_probability":{"type":["integer","null"]},"metadata":{"type":"object","additionalProperties":{}},"created_by":{"type":["string","null"],"format":"uuid"},"created_at":{"type":"string","format":"date-time"}},"required":["id","account_id","deal_id","activity_type","title","description","from_stage_id","to_stage_id","old_value_cents","new_value_cents","old_probability","new_probability","metadata","created_by","created_at"]},"DealActivitiesListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DealActivity"}}},"required":["success","data"]},"AddDealNoteResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DealActivity"}},"required":["success","data"]},"AddDealNoteBody":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":["string","null"],"maxLength":5000},"metadata":{"type":"object","additionalProperties":{}}},"required":["title"]},"DealTasksListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Task"}}},"required":["success","data"]},"CreateDealTaskResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Task"}},"required":["success","data"]},"MoveDealResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Deal"}},"required":["success","data"]},"MoveDealBody":{"type":"object","properties":{"stage_id":{"type":"string","format":"uuid"}},"required":["stage_id"]},"PipelineStats":{"type":"object","properties":{"total_pipeline_value_cents":{"type":"integer"},"total_open_deals":{"type":"integer"},"deals_won":{"type":"integer"},"deals_lost":{"type":"integer"},"revenue_won_cents":{"type":"integer"},"avg_deal_value_cents":{"type":"integer"},"avg_days_to_close":{"type":"integer"},"win_rate":{"type":"number"},"period":{"type":"object","properties":{"start_date":{"type":["string","null"],"format":"date-time"},"end_date":{"type":["string","null"],"format":"date-time"}},"required":["start_date","end_date"]}},"required":["total_pipeline_value_cents","total_open_deals","deals_won","deals_lost","revenue_won_cents","avg_deal_value_cents","avg_days_to_close","win_rate","period"]},"PipelineStatsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/PipelineStats"}},"required":["success","data"]},"Segment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"filter_criteria":{"type":"object","additionalProperties":{}},"is_shared":{"type":"boolean"},"is_system":{"type":"boolean"},"last_used_at":{"type":["string","null"],"format":"date-time"},"use_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","name","slug","description","filter_criteria","is_shared","is_system","last_used_at","use_count","created_at","updated_at"]},"SegmentsListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Segment"}}},"required":["success","data"]},"SegmentResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Segment"}},"required":["success","data"]},"SegmentContactsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}}},"required":["success","data"]},"Stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"color":{"type":"string"},"icon":{"type":["string","null"]},"probability":{"type":"integer","minimum":0,"maximum":100},"expected_days":{"type":"integer","minimum":0},"is_won":{"type":"boolean"},"is_lost":{"type":"boolean"},"is_active":{"type":"boolean"},"is_system":{"type":"boolean"},"sort_order":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","name","slug","description","color","icon","probability","expected_days","is_won","is_lost","is_active","is_system","sort_order","created_at","updated_at"]},"StagesResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Stage"}}},"required":["success","data"]},"DealType":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"color":{"type":"string"},"icon":{"type":["string","null"]},"is_active":{"type":"boolean"},"is_system":{"type":"boolean"},"sort_order":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","name","slug","description","color","icon","is_active","is_system","sort_order","created_at","updated_at"]},"DealTypesResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DealType"}}},"required":["success","data"]},"OrderItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"order_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":["string","null"]},"quantity":{"type":"integer"},"unit_price_cents":{"type":"integer","description":"GST-inclusive price per unit, in cents."},"discount_cents":{"type":"integer","description":"Line discount in cents, already subtracted from `total_cents`."},"tax_cents":{"type":"integer","description":"GST component contained WITHIN this line `total_cents`, never an addition to it."},"total_cents":{"type":"integer","description":"Gross line amount in cents, GST-inclusive: `unit_price_cents` times `quantity`, less `discount_cents`."},"product_type":{"type":["string","null"],"enum":["membership","crm_membership_tiers","event_tickets","event_registration","courses","corporate_seats","extra_seats","product","insurance"]},"product_id":{"type":["string","null"]},"metadata":{"type":["object","null"],"additionalProperties":{}}},"required":["id","order_id","name","description","quantity","unit_price_cents","discount_cents","tax_cents","total_cents","product_type","product_id","metadata"]},"Order":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"membership_id":{"type":["string","null"],"format":"uuid"},"order_number":{"type":"string"},"order_type":{"type":"string","enum":["membership","renewal","one_time","product","event","course"]},"status":{"type":"string"},"payment_status":{"type":"string"},"subtotal_cents":{"type":"integer","description":"Net amount in cents, exclusive of tax: `total_cents` less `tax_cents`."},"discount_cents":{"type":"integer","description":"Discount in cents, already reflected in `total_cents`. Informational: it is not a term in the net, tax, gross triple."},"tax_cents":{"type":"integer","description":"GST component contained WITHIN `total_cents`, never an addition to it. Under the Australian GST-inclusive regime the catalogue price already contains the tax, so this figure is carved out of the gross rather than added to it. Zero when the organisation is not GST-registered and when every line is GST-free or input-taxed."},"total_cents":{"type":"integer","description":"Gross amount in cents the contact pays, GST-inclusive. `subtotal_cents` plus `tax_cents` equals `total_cents`."},"currency":{"type":"string"},"description":{"type":["string","null"]},"metadata":{"type":["object","null"],"additionalProperties":{}},"paid_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"items":{"type":"array","items":{"$ref":"#/components/schemas/OrderItem"}}},"required":["id","contact_id","membership_id","order_number","order_type","status","payment_status","subtotal_cents","discount_cents","tax_cents","total_cents","currency","description","metadata","paid_at","created_at","updated_at","items"]},"OrderLineItemInput":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"]},"quantity":{"type":"integer","exclusiveMinimum":0,"default":1},"unit_price_cents":{"type":"integer","minimum":0,"description":"GST-inclusive price per unit, in cents: what the buyer pays for one unit."},"discount_cents":{"type":"integer","minimum":0,"default":0,"description":"Line discount in cents, subtracted from the line gross."},"tax_cents":{"type":"integer","minimum":0,"description":"Optional assertion of the GST component contained within the line total. The server always computes tax from the organisation regime and treatment rules; when supplied, this value must match that calculation or the request fails with TAX_AMOUNT_MISMATCH and no order is created."},"product_type":{"type":"string","enum":["membership","crm_membership_tiers","event_tickets","event_registration","courses","corporate_seats","extra_seats","product","insurance"]},"product_id":{"type":"string"},"metadata":{"type":"object","additionalProperties":{}}},"required":["name","unit_price_cents"]},"InvitationPreview":{"type":"object","properties":{"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"company_name":{"type":["string","null"]},"tier_name":{"type":"string"},"role":{"type":"string","enum":["admin","member"]},"email":{"type":["string","null"]},"expires_at":{"type":"string"}},"required":["status","company_name","tier_name","role","email","expires_at"]},"InvitationPreviewResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/InvitationPreview"}},"required":["success","data"]},"AcceptInvitationResult":{"type":"object","properties":{"seat_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"corporate_membership_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active"]}},"required":["seat_id","contact_id","corporate_membership_id","status"]},"AcceptInvitationResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AcceptInvitationResult"}},"required":["success","data"]},"CrmLegacyPlanMapping":{"type":"object","properties":{"kind":{"type":"string","enum":["plan","any_member"]},"external_id":{"type":["string","null"]},"status":{"type":"string","enum":["mapped","manual_review"]},"policy":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["active_member"]}},"required":["mode"]},{"type":"object","properties":{"mode":{"type":"string","enum":["selected_tiers"]},"tier_ids":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["mode","tier_ids"]},{"type":"null"}]},"reason":{"type":["string","null"],"enum":["ambiguous","unmatched"]},"candidates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]}}},"required":["kind","external_id","status","policy","reason","candidates"]},"CrmLegacyPlanMappingListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/CrmLegacyPlanMapping"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"CrmMemberSegment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"]},"CrmMemberSegmentListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/CrmMemberSegment"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"CrmEntitlementTypeCatalogueItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"gate_key":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"managed_by_source_id":{"type":["string","null"],"format":"uuid"},"kind":{"type":"string","enum":["platform-gate","entitlement","unrecognised"]}},"required":["id","gate_key","name","description","managed_by_source_id","kind"]},"CrmEntitlementTypeCatalogueResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/CrmEntitlementTypeCatalogueItem"}}},"required":["success","data"]},"CrmEntitlementTypeSync":{"type":"object","properties":{"source_id":{"type":"string","format":"uuid"},"types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"gate_key":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"is_active":{"type":"boolean"},"managed_by_source_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","enum":["created","updated","existing"]}},"required":["id","gate_key","name","description","is_active","managed_by_source_id","status"]}}},"required":["source_id","types"]},"CrmEntitlementTypeSyncResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CrmEntitlementTypeSync"}},"required":["success","data"]},"CrmEntitlementTypeSyncRequest":{"type":"object","properties":{"source_key":{"type":"string","pattern":"^[a-z][a-z0-9_.]{1,62}[a-z0-9]$"},"entries":{"type":"array","items":{"type":"object","properties":{"gate_key":{"type":"string","pattern":"^[a-z][a-z0-9_.]{1,62}[a-z0-9]$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":["string","null"],"maxLength":500}},"required":["gate_key","name"]},"minItems":1,"maxItems":200}},"required":["source_key","entries"]},"CrmEntitlementGrantReconcile":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"contact_created":{"type":"boolean"},"source_id":{"type":"string","format":"uuid"},"granted":{"type":"array","items":{"type":"string"}},"refreshed":{"type":"array","items":{"type":"string"}},"unchanged":{"type":"array","items":{"type":"string"}},"revoked":{"type":"array","items":{"type":"string"}}},"required":["contact_id","contact_created","source_id","granted","refreshed","unchanged","revoked"]},"CrmEntitlementGrantReconcileResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CrmEntitlementGrantReconcile"}},"required":["success","data"]},"CrmEntitlementGrantReconcileRequest":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"external_source":{"type":"string","minLength":1,"maxLength":64},"external_id":{"type":"string","minLength":1,"maxLength":255},"first_name":{"type":"string","minLength":1,"maxLength":200},"last_name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email"},"source_key":{"type":"string","pattern":"^[a-z][a-z0-9_.]{1,62}[a-z0-9]$"},"entries":{"type":"array","items":{"type":"object","properties":{"gate_key":{"type":"string","pattern":"^[a-z][a-z0-9_.]{1,62}[a-z0-9]$"},"starts_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"quantity_allowed":{"type":["integer","null"],"minimum":0},"quantity_remaining":{"type":["integer","null"],"minimum":0},"external_ref":{"type":["string","null"],"maxLength":200}},"required":["gate_key"]},"maxItems":200}},"required":["source_key","entries"]},"EventListItem":{"type":"object","properties":{"cpd_points":{"type":"integer","minimum":0,"maximum":999},"default_cpd_category_id":{"type":["string","null"],"format":"uuid"},"default_cpd_type_id":{"type":["string","null"],"format":"uuid"},"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"published_at":{"type":["string","null"],"format":"date-time"},"status":{"type":"string"},"hero_image_url":{"type":["string","null"]},"gallery_images":{"type":["array","null"],"items":{"type":"string"}},"meta_title":{"type":["string","null"]},"meta_description":{"type":["string","null"]},"custom_fields":{"type":["object","null"],"additionalProperties":{}},"external_source":{"type":["string","null"]},"external_id":{"type":["string","null"]},"external_url":{"type":["string","null"]},"description":{"type":["string","null"]},"short_description":{"type":["string","null"]},"venue_type":{"type":"string"},"venue_name":{"type":["string","null"]},"venue_address":{"type":["string","null"]},"venue_city":{"type":["string","null"]},"venue_state":{"type":["string","null"]},"venue_postcode":{"type":["string","null"]},"venue_country":{"type":["string","null"]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"virtual_url":{"type":["string","null"]},"all_day":{"type":"boolean"},"registration_required":{"type":"boolean"},"member_only":{"type":"boolean"},"purchase_start_at":{"type":["string","null"],"format":"date-time"},"purchase_end_at":{"type":["string","null"],"format":"date-time"},"start_date":{"type":"string","format":"date-time"},"end_date":{"type":"string","format":"date-time"},"timezone":{"type":"string"},"capacity":{"type":["integer","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}},"viewer_price_group":{"type":"string","enum":["member","non_member","corporate"],"description":"Optional-identity enrichment (Decision 2.10): present when the caller supplies a valid member bearer token — the viewer's price group resolved from their contact and active memberships with the organiser account. Absent for anonymous callers."},"my_registration":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"anyOf":[{"type":"string","enum":["pending","pending_payment","confirmed","cancelled","attended","no_show","reserved","expired"]},{"type":"string"}],"description":"Reserved places await invoice payment and expired places have been released. Neither is an admission credential. Existing status strings remain accepted."},"attendance_status":{"type":"string","enum":["attended","no_show","not_checked_in"]},"ticket_id":{"type":"string","format":"uuid"}},"required":["id","status","attendance_status","ticket_id"],"description":"Optional-identity enrichment (Decision 2.10): present when the caller supplies a valid member bearer token — the viewer's own non-cancelled registration for this event, or null when they have none. Absent for anonymous callers."},"teaser":{"type":"object","properties":{"access":{"type":"string","enum":["member_only"]},"event_url":{"type":"string","format":"uri"}},"required":["access","event_url"],"description":"Present when the caller may discover a members-only event but may not access its protected details or tickets."},"tickets":{"type":"array","items":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"is_active":{"type":"boolean"},"allocation":{"type":"integer"},"sold_count":{"type":"integer"}},"required":["id","name","is_active","allocation","sold_count"]},"pricingTiers":{"type":"array","items":{"type":"object","properties":{"tier":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"start_at":{"type":["string","null"],"format":"date-time"},"end_at":{"type":["string","null"],"format":"date-time"},"member_price":{"type":["number","null"],"description":"Member price. GST-inclusive amount the buyer pays. Tax is carved out of this figure when the order is created, never added to it at checkout."},"non_member_price":{"type":["number","null"],"description":"Non-member price. GST-inclusive amount the buyer pays. Tax is carved out of this figure when the order is created, never added to it at checkout."},"corporate_price":{"type":["number","null"],"description":"Corporate price. GST-inclusive amount the buyer pays. Tax is carved out of this figure when the order is created, never added to it at checkout."}},"required":["id","name","start_at","end_at","member_price","non_member_price","corporate_price"]},"isActive":{"type":"boolean"}},"required":["tier","isActive"]}},"capacityRemaining":{"type":"integer"}},"required":["ticket","pricingTiers","capacityRemaining"]}},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"sort_order":{"type":"integer"}},"required":["id","name","slug","description","sort_order"]}},"speakers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"title":{"type":["string","null"]},"bio":{"type":["string","null"]},"photo_url":{"type":["string","null"]},"sort_order":{"type":"integer"}},"required":["id","name","title","bio","photo_url","sort_order"]}},"sponsors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"tier":{"type":"string"},"logo_url":{"type":["string","null"]},"website":{"type":["string","null"]},"sort_order":{"type":"integer"}},"required":["id","name","tier","logo_url","website","sort_order"]}},"waitlist":{"type":"object","properties":{"has_waitlist":{"type":"boolean"},"is_available":{"type":"boolean"},"waiting_count":{"type":"integer"}},"required":["has_waitlist","is_available","waiting_count"]},"category":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]}},"price_summary":{"type":"object","properties":{"member_from":{"type":["number","null"],"description":"Lowest GST-inclusive member price across the pricing tiers of the event, or null when no tier carries one."},"non_member_from":{"type":["number","null"],"description":"Lowest GST-inclusive non-member price across the pricing tiers of the event, or null when no tier carries one."}},"required":["member_from","non_member_from"]},"sold_out":{"type":"boolean"}},"required":["cpd_points","default_cpd_category_id","default_cpd_type_id","id","account_id","name","slug","published_at","status","hero_image_url","gallery_images","meta_title","meta_description","custom_fields","external_source","external_id","external_url","description","short_description","venue_type","venue_name","venue_address","venue_city","venue_state","venue_postcode","venue_country","latitude","longitude","virtual_url","all_day","registration_required","member_only","purchase_start_at","purchase_end_at","start_date","end_date","timezone","capacity","created_at","updated_at","topics","category","tags","price_summary","sold_out"]},"TicketEntry":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"is_active":{"type":"boolean"},"allocation":{"type":"integer"},"sold_count":{"type":"integer"}},"required":["id","name","is_active","allocation","sold_count"]},"pricingTiers":{"type":"array","items":{"type":"object","properties":{"tier":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"start_at":{"type":["string","null"],"format":"date-time"},"end_at":{"type":["string","null"],"format":"date-time"},"member_price":{"type":["number","null"],"description":"Member price. GST-inclusive amount the buyer pays. Tax is carved out of this figure when the order is created, never added to it at checkout."},"non_member_price":{"type":["number","null"],"description":"Non-member price. GST-inclusive amount the buyer pays. Tax is carved out of this figure when the order is created, never added to it at checkout."},"corporate_price":{"type":["number","null"],"description":"Corporate price. GST-inclusive amount the buyer pays. Tax is carved out of this figure when the order is created, never added to it at checkout."}},"required":["id","name","start_at","end_at","member_price","non_member_price","corporate_price"]},"isActive":{"type":"boolean"}},"required":["tier","isActive"]}},"capacityRemaining":{"type":"integer"}},"required":["ticket","pricingTiers","capacityRemaining"]},"EventCategory":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"parent_id":{"type":["string","null"],"format":"uuid"},"slug":{"type":"string"},"description":{"type":["string","null"]},"sort_order":{"type":"number"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","parent_id","slug","description","sort_order","created_at","updated_at"]},"EventVenue":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"address":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"country":{"type":["string","null"]},"postcode":{"type":["string","null"]},"capacity":{"type":["integer","null"]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"notes":{"type":["string","null"]},"is_default":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","address","city","state","country","postcode","capacity","latitude","longitude","notes","is_default","created_at","updated_at"]},"EventRegisterResponse":{"type":"object","properties":{"registrations":{"type":"array","items":{"type":"object","properties":{"registrationId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["confirmed","pending_payment"]},"cartItemId":{"type":"string","format":"uuid"},"finalPrice":{"type":"number"}},"required":["registrationId","status"]}}},"required":["registrations"]},"EventBeneficiary":{"type":"object","properties":{"beneficiary_type":{"type":"string","enum":["self","named","unnamed"],"default":"self","description":"Type of beneficiary: self (current user), named (specific person), or unnamed (placeholder; assigned post-purchase)."},"beneficiary_email":{"type":"string","format":"email","description":"Email of the beneficiary. Required when `beneficiary_type` is `named` so the attendee can be contacted."},"beneficiary_name":{"type":"string","description":"Name of the beneficiary (display only)."},"crm_contact_id":{"type":"string","format":"uuid","description":"CRM contact ID of the purchaser if not derivable from the bearer JWT."},"beneficiary_contact_id":{"type":"string","format":"uuid","description":"CRM contact ID of the beneficiary. If provided, name and email are resolved from this contact. Not accepted on a guest registration (a request carrying `buyer` and no bearer token): it returns 400 `VALIDATION_ERROR`. Name a guest attendee with `beneficiary_name` and `beneficiary_email`."}}},"RegistrationManagement":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event_id":{"type":"string","format":"uuid"},"ticket_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"status":{"anyOf":[{"type":"string","enum":["pending","pending_payment","confirmed","cancelled","attended","no_show","reserved","expired"]},{"type":"string"}],"description":"Reserved places await invoice payment and expired places have been released. Neither is an admission credential. Existing status strings remain accepted."},"payment_status":{"type":["string","null"]},"beneficiary_type":{"type":["string","null"]},"beneficiary_name":{"type":["string","null"]},"beneficiary_email":{"type":["string","null"]},"beneficiary_user_id":{"type":["string","null"],"format":"uuid"},"crm_contact_id":{"type":["string","null"],"format":"uuid"},"beneficiary_id":{"type":["string","null"],"format":"uuid"},"booked_by":{"type":["string","null"],"format":"uuid"},"price_group":{"type":["string","null"]},"final_price":{"type":["number","null"],"description":"GST-inclusive amount charged for this registration. Tax is a component of this figure, carved out when the order is created, never added at checkout."},"registered_at":{"type":"string","format":"date-time"},"cancelled_at":{"type":["string","null"],"format":"date-time"},"cancelled_reason":{"type":["string","null"]},"checked_in_at":{"type":["string","null"],"format":"date-time"},"checked_in_by":{"type":["string","null"],"format":"uuid"}},"required":["id","event_id","ticket_id","account_id","status","payment_status","beneficiary_type","beneficiary_name","beneficiary_email","beneficiary_user_id","crm_contact_id","beneficiary_id","booked_by","price_group","final_price","registered_at","cancelled_at","cancelled_reason","checked_in_at","checked_in_by"]},"RegistrationAttendee":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event_id":{"type":"string","format":"uuid"},"ticket_id":{"type":"string","format":"uuid"},"status":{"type":"string"},"beneficiary_type":{"type":"string"},"beneficiary_name":{"type":["string","null"]},"beneficiary_email":{"type":["string","null"]},"beneficiary_id":{"type":["string","null"],"format":"uuid"},"registration_data":{"type":"object","additionalProperties":{}}},"required":["id","event_id","ticket_id","status","beneficiary_type","beneficiary_name","beneficiary_email","beneficiary_id","registration_data"]},"MyTicketEntry":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"anyOf":[{"type":"string","enum":["pending","pending_payment","confirmed","cancelled","attended","no_show","reserved","expired"]},{"type":"string"}],"description":"Reserved places await invoice payment and expired places have been released. Neither is an admission credential. Existing status strings remain accepted."},"payment_status":{"type":"string"},"beneficiary_type":{"type":"string"},"beneficiary_name":{"type":["string","null"]},"beneficiary_email":{"type":["string","null"]},"crm_contact_id":{"type":["string","null"],"format":"uuid"},"beneficiary_id":{"type":["string","null"],"format":"uuid"},"price_group":{"type":"string"},"final_price":{"type":["number","null"],"description":"GST-inclusive amount charged for this registration. Tax is a component of this figure, carved out when the order is created, never added at checkout."},"registered_at":{"type":"string","format":"date-time"},"cancelled_at":{"type":["string","null"],"format":"date-time"},"checked_in_at":{"type":["string","null"],"format":"date-time"},"event":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"start_date":{"type":"string","format":"date-time"},"end_date":{"type":"string","format":"date-time"},"timezone":{"type":"string"}},"required":["id","name","slug","start_date","end_date","timezone"]}},"required":["id","status","payment_status","beneficiary_type","beneficiary_name","beneficiary_email","crm_contact_id","beneficiary_id","price_group","final_price","registered_at","cancelled_at","checked_in_at","event"]},"EventWaitlistJoinResult":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string"},"position":{"type":"integer"}},"required":["id","status","position"]},"EventWaitlistLeaveResult":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string"}},"required":["id","status"]},"EventRsvpResult":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string"},"rsvp_status":{"type":"string","enum":["attending","not_attending","maybe","pending"]},"updated_at":{"type":"string","format":"date-time"}},"required":["id","status","rsvp_status","updated_at"]},"EventEmbedResponse":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","additionalProperties":{}}},"layout":{"type":"string"}},"required":["events","layout"]},"Event":{"type":"object","properties":{"cpd_points":{"type":"integer","minimum":0,"maximum":999},"default_cpd_category_id":{"type":["string","null"],"format":"uuid"},"default_cpd_type_id":{"type":["string","null"],"format":"uuid"},"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"published_at":{"type":["string","null"],"format":"date-time"},"status":{"type":"string"},"hero_image_url":{"type":["string","null"]},"gallery_images":{"type":["array","null"],"items":{"type":"string"}},"meta_title":{"type":["string","null"]},"meta_description":{"type":["string","null"]},"custom_fields":{"type":["object","null"],"additionalProperties":{}},"external_source":{"type":["string","null"]},"external_id":{"type":["string","null"]},"external_url":{"type":["string","null"]},"description":{"type":["string","null"]},"short_description":{"type":["string","null"]},"venue_type":{"type":"string"},"venue_name":{"type":["string","null"]},"venue_address":{"type":["string","null"]},"venue_city":{"type":["string","null"]},"venue_state":{"type":["string","null"]},"venue_postcode":{"type":["string","null"]},"venue_country":{"type":["string","null"]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"virtual_url":{"type":["string","null"]},"all_day":{"type":"boolean"},"registration_required":{"type":"boolean"},"member_only":{"type":"boolean"},"purchase_start_at":{"type":["string","null"],"format":"date-time"},"purchase_end_at":{"type":["string","null"],"format":"date-time"},"start_date":{"type":"string","format":"date-time"},"end_date":{"type":"string","format":"date-time"},"timezone":{"type":"string"},"capacity":{"type":["integer","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}},"viewer_price_group":{"type":"string","enum":["member","non_member","corporate"],"description":"Optional-identity enrichment (Decision 2.10): present when the caller supplies a valid member bearer token — the viewer's price group resolved from their contact and active memberships with the organiser account. Absent for anonymous callers."},"my_registration":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"anyOf":[{"type":"string","enum":["pending","pending_payment","confirmed","cancelled","attended","no_show","reserved","expired"]},{"type":"string"}],"description":"Reserved places await invoice payment and expired places have been released. Neither is an admission credential. Existing status strings remain accepted."},"attendance_status":{"type":"string","enum":["attended","no_show","not_checked_in"]},"ticket_id":{"type":"string","format":"uuid"}},"required":["id","status","attendance_status","ticket_id"],"description":"Optional-identity enrichment (Decision 2.10): present when the caller supplies a valid member bearer token — the viewer's own non-cancelled registration for this event, or null when they have none. Absent for anonymous callers."},"teaser":{"type":"object","properties":{"access":{"type":"string","enum":["member_only"]},"event_url":{"type":"string","format":"uri"}},"required":["access","event_url"],"description":"Present when the caller may discover a members-only event but may not access its protected details or tickets."}},"required":["cpd_points","default_cpd_category_id","default_cpd_type_id","id","account_id","name","slug","published_at","status","hero_image_url","gallery_images","meta_title","meta_description","custom_fields","external_source","external_id","external_url","description","short_description","venue_type","venue_name","venue_address","venue_city","venue_state","venue_postcode","venue_country","latitude","longitude","virtual_url","all_day","registration_required","member_only","purchase_start_at","purchase_end_at","start_date","end_date","timezone","capacity","created_at","updated_at","topics"]},"CreateEventInput":{"type":"object","properties":{"cpd_points":{"type":"integer","minimum":0,"maximum":999},"default_cpd_category_id":{"type":["string","null"],"format":"uuid"},"default_cpd_type_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":50000},"short_description":{"type":"string","maxLength":500},"start_date":{"type":"string","format":"date-time"},"end_date":{"type":"string","format":"date-time"},"timezone":{"type":"string","maxLength":100},"all_day":{"type":"boolean"},"venue_type":{"type":"string","enum":["physical","virtual","hybrid"]},"venue_name":{"type":"string","maxLength":200},"venue_address":{"type":"string","maxLength":500},"venue_city":{"type":"string","maxLength":100},"venue_state":{"type":"string","maxLength":100},"venue_postcode":{"type":"string","maxLength":20},"venue_country":{"type":"string","maxLength":100},"latitude":{"type":"number"},"longitude":{"type":"number"},"virtual_url":{"type":"string","format":"uri"},"capacity":{"type":["integer","null"],"minimum":0},"registration_required":{"type":"boolean"},"member_only":{"type":"boolean"},"hero_image_url":{"type":"string","format":"uri"},"gallery_images":{"type":"array","items":{"type":"string","format":"uri"}},"meta_title":{"type":"string","maxLength":200},"meta_description":{"type":"string","maxLength":500},"custom_fields":{"type":"object","additionalProperties":{}},"loop_discussions_enabled":{"type":"boolean"},"loop_archive_policy":{"type":"string","enum":["keep_forever","archive_30","archive_60","archive_90","archive_immediate"]},"purchase_start_at":{"type":"string","format":"date-time"},"purchase_end_at":{"type":"string","format":"date-time"},"category_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"tag_ids":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["name","start_date","end_date"],"description":"Event settings including optional CPD recommendation metadata. Points are whole numbers from 0 to 999; category and type are independent account-owned defaults. Metadata does not award attendance CPD."},"UpdateEventInput":{"type":"object","properties":{"cpd_points":{"type":"integer","minimum":0,"maximum":999},"default_cpd_category_id":{"type":["string","null"],"format":"uuid"},"default_cpd_type_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":50000},"short_description":{"type":"string","maxLength":500},"start_date":{"type":"string","format":"date-time"},"end_date":{"type":"string","format":"date-time"},"timezone":{"type":"string","maxLength":100},"all_day":{"type":"boolean"},"venue_type":{"type":"string","enum":["physical","virtual","hybrid"]},"venue_name":{"type":"string","maxLength":200},"venue_address":{"type":"string","maxLength":500},"venue_city":{"type":"string","maxLength":100},"venue_state":{"type":"string","maxLength":100},"venue_postcode":{"type":"string","maxLength":20},"venue_country":{"type":"string","maxLength":100},"latitude":{"type":"number"},"longitude":{"type":"number"},"virtual_url":{"type":"string","format":"uri"},"capacity":{"type":["integer","null"],"minimum":0},"registration_required":{"type":"boolean"},"member_only":{"type":"boolean"},"hero_image_url":{"type":"string","format":"uri"},"gallery_images":{"type":"array","items":{"type":"string","format":"uri"}},"meta_title":{"type":"string","maxLength":200},"meta_description":{"type":"string","maxLength":500},"custom_fields":{"type":"object","additionalProperties":{}},"loop_discussions_enabled":{"type":"boolean"},"loop_archive_policy":{"type":"string","enum":["keep_forever","archive_30","archive_60","archive_90","archive_immediate"]},"purchase_start_at":{"type":"string","format":"date-time"},"purchase_end_at":{"type":"string","format":"date-time"},"category_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"tag_ids":{"type":"array","items":{"type":"string","format":"uuid"}}}},"EventDeletedResult":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]},"EventTicket":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"is_active":{"type":"boolean"},"allocation":{"type":"integer"},"sold_count":{"type":"integer"}},"required":["id","name","is_active","allocation","sold_count"]},"CreateTicketInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000},"delivery_mode":{"type":"string","enum":["in_person","virtual","multi_session"]},"allocation":{"type":"integer","minimum":0},"low_stock_threshold":{"type":"integer","minimum":0},"sort_order":{"type":"integer"},"is_active":{"type":"boolean"}},"required":["name","allocation"]},"UpdateTicketInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000},"delivery_mode":{"type":"string","enum":["in_person","virtual","multi_session"]},"allocation":{"type":"integer","minimum":0},"low_stock_threshold":{"type":"integer","minimum":0},"sort_order":{"type":"integer"},"is_active":{"type":"boolean"}}},"CreateEventCategoryInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000},"parentId":{"type":"string","format":"uuid"},"slug":{"type":"string","maxLength":200},"sortOrder":{"type":"integer"}},"required":["name"]},"UpdateEventCategoryInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000},"parentId":{"type":["string","null"],"format":"uuid"},"sortOrder":{"type":"integer"}}},"CreateVenueInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"address":{"type":["string","null"],"maxLength":500},"city":{"type":["string","null"],"maxLength":100},"state":{"type":["string","null"],"maxLength":100},"postcode":{"type":["string","null"],"maxLength":20},"country":{"type":["string","null"],"maxLength":100},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"capacity":{"type":["integer","null"],"minimum":0},"notes":{"type":["string","null"],"maxLength":2000},"is_default":{"type":"boolean"}},"required":["name"]},"UpdateVenueInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"address":{"type":["string","null"],"maxLength":500},"city":{"type":["string","null"],"maxLength":100},"state":{"type":["string","null"],"maxLength":100},"postcode":{"type":["string","null"],"maxLength":20},"country":{"type":["string","null"],"maxLength":100},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"capacity":{"type":["integer","null"],"minimum":0},"notes":{"type":["string","null"],"maxLength":2000},"is_default":{"type":"boolean"}}},"AttendeeField":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"field_key":{"type":"string"},"name":{"type":"string"},"field_type":{"type":"string"},"is_required":{"type":"boolean"},"is_active":{"type":"boolean"},"sort_order":{"type":"integer"},"container_id":{"type":["string","null"],"format":"uuid"},"options":{"type":["array","null"],"items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","event_id","account_id","field_key","name","field_type","is_required","is_active","sort_order","container_id","options","created_at","updated_at"]},"CreateAttendeeFieldInput":{"type":"object","properties":{"field_key":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[a-z][a-z0-9_]*$"},"name":{"type":"string","minLength":1,"maxLength":255},"field_type":{"type":"string","enum":["text","paragraph","number","email","phone","url","date","datetime","select","multi_select","checkbox","checkbox_group","radio","toggle","array","item_list","file","image"]},"is_required":{"type":"boolean","default":false},"is_active":{"type":"boolean","default":true},"sort_order":{"type":"integer"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","minLength":1,"maxLength":255},"label":{"type":"string","minLength":1,"maxLength":255}},"required":["value","label"]}}},"required":["field_key","name","field_type"]},"UpdateAttendeeFieldInput":{"type":"object","properties":{"field_key":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[a-z][a-z0-9_]*$"},"name":{"type":"string","minLength":1,"maxLength":255},"field_type":{"type":"string","enum":["text","paragraph","number","email","phone","url","date","datetime","select","multi_select","checkbox","checkbox_group","radio","toggle","array","item_list","file","image"]},"is_required":{"type":"boolean","default":false},"is_active":{"type":"boolean","default":true},"sort_order":{"type":"integer"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","minLength":1,"maxLength":255},"label":{"type":"string","minLength":1,"maxLength":255}},"required":["value","label"]}}}},"JobListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"short_description":{"type":["string","null"]},"company_name":{"type":["string","null"]},"company_logo_url":{"type":["string","null"]},"company_website":{"type":["string","null"]},"company_description":{"type":["string","null"]},"location_type":{"type":"string","enum":["on-site","hybrid","remote"]},"location_city":{"type":["string","null"]},"location_state":{"type":["string","null"]},"location_postcode":{"type":["string","null"]},"location_country":{"type":["string","null"]},"distance_km":{"type":["number","null"]},"employment_type":{"type":"string","enum":["full-time","part-time","contract","casual","internship"]},"experience_level":{"type":["string","null"]},"salary_min":{"type":["integer","null"]},"salary_max":{"type":["integer","null"]},"salary_currency":{"type":["string","null"]},"salary_period":{"type":["string","null"]},"salary_range":{"type":["string","null"]},"show_salary":{"type":"boolean"},"application_url":{"type":["string","null"]},"application_email":{"type":["string","null"]},"application_instructions":{"type":["string","null"]},"status":{"type":"string"},"is_featured":{"type":"boolean"},"sponsor_level":{"type":"integer","minimum":0,"maximum":3},"published_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"view_count":{"type":"integer","minimum":0},"apply_click_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"icon":{"type":["string","null"]},"color":{"type":["string","null"]}},"required":["id","name","slug","icon","color"]}},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}}},"required":["id","account_id","title","slug","description","short_description","company_name","company_logo_url","company_website","company_description","location_type","location_city","location_state","location_postcode","location_country","distance_km","employment_type","experience_level","salary_min","salary_max","salary_currency","salary_period","salary_range","show_salary","application_url","application_email","application_instructions","status","is_featured","sponsor_level","published_at","expires_at","view_count","apply_click_count","created_at","updated_at","categories","tags","topics"]},"JobsListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/JobListItem"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"JobCategoryListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"icon":{"type":["string","null"]},"color":{"type":["string","null"]},"parent_id":{"type":["string","null"],"format":"uuid"},"sort_order":{"type":"integer"}},"required":["id","name","slug","description","icon","color","parent_id","sort_order"]},"JobCategoriesResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/JobCategoryListItem"}}},"required":["success","data"]},"JobTagListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]},"JobTagsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/JobTagListItem"}}},"required":["success","data"]},"Job":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"short_description":{"type":["string","null"]},"company_name":{"type":["string","null"]},"company_logo_url":{"type":["string","null"]},"company_website":{"type":["string","null"]},"company_description":{"type":["string","null"]},"location_type":{"type":"string","enum":["on-site","hybrid","remote"]},"location_city":{"type":["string","null"]},"location_state":{"type":["string","null"]},"location_postcode":{"type":["string","null"]},"location_country":{"type":["string","null"]},"distance_km":{"type":["number","null"]},"employment_type":{"type":"string","enum":["full-time","part-time","contract","casual","internship"]},"experience_level":{"type":["string","null"]},"salary_min":{"type":["integer","null"]},"salary_max":{"type":["integer","null"]},"salary_currency":{"type":["string","null"]},"salary_period":{"type":["string","null"]},"salary_range":{"type":["string","null"]},"show_salary":{"type":"boolean"},"application_url":{"type":["string","null"]},"application_email":{"type":["string","null"]},"application_instructions":{"type":["string","null"]},"status":{"type":"string"},"is_featured":{"type":"boolean"},"sponsor_level":{"type":"integer","minimum":0,"maximum":3},"published_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"view_count":{"type":"integer","minimum":0},"apply_click_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"icon":{"type":["string","null"]},"color":{"type":["string","null"]}},"required":["id","name","slug","icon","color"]}},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}},"reference_number":{"type":["string","null"]},"contact_name":{"type":["string","null"]},"contact_phone":{"type":["string","null"]}},"required":["id","account_id","title","slug","description","short_description","company_name","company_logo_url","company_website","company_description","location_type","location_city","location_state","location_postcode","location_country","distance_km","employment_type","experience_level","salary_min","salary_max","salary_currency","salary_period","salary_range","show_salary","application_url","application_email","application_instructions","status","is_featured","sponsor_level","published_at","expires_at","view_count","apply_click_count","created_at","updated_at","categories","tags","topics","reference_number","contact_name","contact_phone"]},"JobResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Job"}},"required":["success","data"]},"ContactJobSubmission":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"short_description":{"type":["string","null"]},"company_name":{"type":["string","null"]},"company_logo_url":{"type":["string","null"]},"company_website":{"type":["string","null"]},"company_description":{"type":["string","null"]},"location_type":{"type":"string","enum":["on-site","hybrid","remote"]},"location_city":{"type":["string","null"]},"location_state":{"type":["string","null"]},"location_postcode":{"type":["string","null"]},"location_country":{"type":["string","null"]},"distance_km":{"type":["number","null"]},"employment_type":{"type":"string","enum":["full-time","part-time","contract","casual","internship"]},"experience_level":{"type":["string","null"]},"salary_min":{"type":["integer","null"]},"salary_max":{"type":["integer","null"]},"salary_currency":{"type":["string","null"]},"salary_period":{"type":["string","null"]},"salary_range":{"type":["string","null"]},"show_salary":{"type":"boolean"},"application_url":{"type":["string","null"]},"application_email":{"type":["string","null"]},"application_instructions":{"type":["string","null"]},"is_featured":{"type":"boolean"},"sponsor_level":{"type":"integer","minimum":0,"maximum":3},"published_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"view_count":{"type":"integer","minimum":0},"apply_click_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"icon":{"type":["string","null"]},"color":{"type":["string","null"]}},"required":["id","name","slug","icon","color"]}},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}},"reference_number":{"type":["string","null"]},"contact_name":{"type":["string","null"]},"contact_phone":{"type":["string","null"]},"status":{"type":"string","enum":["checking_credit","pending","no_credit","approved","rejected","withdrawn","closed"]},"expired":{"type":"boolean"},"filled":{"type":"boolean"},"rejection_reason":{"type":["string","null"]},"credit_ref":{"type":["string","null"]},"submitted_at":{"type":"string","format":"date-time"},"reviewed_at":{"type":["string","null"],"format":"date-time"},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"external_source":{"type":"string"},"external_id":{"type":"string"}},"required":["id","external_source","external_id"]}},"required":["id","account_id","title","slug","description","short_description","company_name","company_logo_url","company_website","company_description","location_type","location_city","location_state","location_postcode","location_country","distance_km","employment_type","experience_level","salary_min","salary_max","salary_currency","salary_period","salary_range","show_salary","application_url","application_email","application_instructions","is_featured","sponsor_level","published_at","expires_at","view_count","apply_click_count","created_at","updated_at","categories","tags","topics","reference_number","contact_name","contact_phone","status","rejection_reason","credit_ref","submitted_at","reviewed_at","contact"]},"ContactJobSubmissionsListResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/ContactJobSubmission"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"ContactSubmissionAccepted":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["checking_credit","pending","no_credit","approved","rejected","withdrawn","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"external_id":{"type":"string"}},"required":["id","external_id"]},"contact_created":{"type":"boolean"}},"required":["id","status","contact","contact_created"]},"ContactSubmissionAcceptedResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ContactSubmissionAccepted"}},"required":["success","data"]},"CreateContactSubmissionBody":{"type":"object","properties":{"contact":{"type":"object","properties":{"external_source":{"type":"string","minLength":1,"maxLength":100},"external_id":{"type":"string","minLength":1,"maxLength":200},"first_name":{"type":"string","minLength":1,"maxLength":100},"last_name":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","maxLength":320,"format":"email"}},"required":["external_source","external_id","first_name","last_name","email"],"additionalProperties":false},"job":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":10000},"short_description":{"type":"string","maxLength":500},"company_name":{"type":"string","maxLength":200},"company_website":{"type":"string","maxLength":1000,"format":"uri","pattern":"^https?:\\/\\/"},"company_logo_url":{"type":"string","maxLength":2048,"format":"uri","pattern":"^https:\\/\\/"},"employment_type":{"type":"string","enum":["full-time","part-time","contract","casual","internship"]},"experience_level":{"type":"string","enum":["entry","mid","senior","executive"]},"category_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50},"tag_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50},"location_type":{"type":"string","enum":["on-site","hybrid","remote"]},"location_city":{"type":"string","maxLength":100},"location_state":{"type":"string","maxLength":100},"location_postcode":{"type":"string","maxLength":10},"location_country":{"type":"string","maxLength":100},"salary_min":{"type":"integer","minimum":0,"maximum":100000000},"salary_max":{"type":"integer","minimum":0,"maximum":100000000},"salary_period":{"type":"string","enum":["hourly","annual","project"]},"show_salary":{"type":"boolean"},"application_url":{"type":"string","maxLength":1000,"format":"uri","pattern":"^https?:\\/\\/"},"application_email":{"type":"string","maxLength":320,"format":"email"},"application_instructions":{"type":"string","maxLength":5000},"reference_number":{"type":"string","maxLength":100},"contact_name":{"type":"string","maxLength":200},"contact_phone":{"type":"string","maxLength":50}},"required":["title","employment_type","location_type"],"additionalProperties":false}},"required":["contact","job"],"additionalProperties":false},"JobCreditCount":{"type":"object","properties":{"available":{"type":"integer","minimum":0},"checked_at":{"type":"string"},"stale":{"type":"boolean"}},"required":["available","checked_at","stale"]},"JobCreditCountResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/JobCreditCount"}},"required":["success","data"]},"ContactJobSubmissionResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ContactJobSubmission"}},"required":["success","data"]},"ContactJobSubmissionUpdateResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ContactJobSubmission"}},"required":["success","data"]},"UpdateContactSubmissionBody":{"type":"object","properties":{"contact":{"type":"object","properties":{"external_source":{"type":"string","minLength":1,"maxLength":100},"external_id":{"type":"string","minLength":1,"maxLength":200}},"required":["external_source","external_id"],"additionalProperties":false},"job":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":["string","null"],"maxLength":10000},"short_description":{"type":["string","null"],"maxLength":500},"company_name":{"type":["string","null"],"maxLength":200},"company_website":{"type":["string","null"],"maxLength":1000,"format":"uri","pattern":"^https?:\\/\\/"},"company_logo_url":{"type":["string","null"],"maxLength":2048,"format":"uri","pattern":"^https:\\/\\/"},"employment_type":{"type":"string","enum":["full-time","part-time","contract","casual","internship"]},"experience_level":{"type":["string","null"],"enum":["entry","mid","senior","executive"]},"category_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50},"tag_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50},"location_type":{"type":"string","enum":["on-site","hybrid","remote"]},"location_city":{"type":["string","null"],"maxLength":100},"location_state":{"type":["string","null"],"maxLength":100},"location_postcode":{"type":["string","null"],"maxLength":10},"location_country":{"type":["string","null"],"maxLength":100},"salary_min":{"type":["integer","null"],"minimum":0,"maximum":100000000},"salary_max":{"type":["integer","null"],"minimum":0,"maximum":100000000},"salary_period":{"type":"string","enum":["hourly","annual","project"]},"show_salary":{"type":"boolean"},"application_url":{"type":["string","null"],"maxLength":1000,"format":"uri","pattern":"^https?:\\/\\/"},"application_email":{"type":["string","null"],"maxLength":320,"format":"email"},"application_instructions":{"type":["string","null"],"maxLength":5000},"reference_number":{"type":["string","null"],"maxLength":100},"contact_name":{"type":["string","null"],"maxLength":200},"contact_phone":{"type":["string","null"],"maxLength":50}},"additionalProperties":false}},"required":["contact","job"],"additionalProperties":false},"ContactJobSubmissionWithdrawResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ContactJobSubmission"}},"required":["success","data"]},"WithdrawContactSubmissionBody":{"type":"object","properties":{"contact":{"type":"object","properties":{"external_source":{"type":"string","minLength":1,"maxLength":100},"external_id":{"type":"string","minLength":1,"maxLength":200}},"required":["external_source","external_id"],"additionalProperties":false}},"required":["contact"],"additionalProperties":false},"ContactJobSubmissionCloseResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ContactJobSubmission"}},"required":["success","data"]},"CloseContactSubmissionBody":{"type":"object","properties":{"contact":{"type":"object","properties":{"external_source":{"type":"string","minLength":1,"maxLength":100},"external_id":{"type":"string","minLength":1,"maxLength":200}},"required":["external_source","external_id"],"additionalProperties":false},"filled":{"type":"boolean"}},"required":["contact"],"additionalProperties":false},"LmsLessonContent":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["signed-url"]},"url":{"type":"string"},"expiresIn":{"type":"number"}},"required":["type","url","expiresIn"]},{"type":"object","properties":{"type":{"type":"string","enum":["external"]},"url":{"type":"string"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["html"]},"content":{"type":"string"}},"required":["type","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["pdf-pages"]},"pageCount":{"type":"number"},"pages":{"type":"array","items":{"type":"object","properties":{"page":{"type":"number"},"url":{"type":"string"}},"required":["page","url"]}},"download":{"type":"object","properties":{"url":{"type":"string"},"expiresIn":{"type":"number"}},"required":["url","expiresIn"],"description":"A signed URL to the PDF version of the document, never the uploaded Word or PowerPoint original. Present only when the organisation allows document downloads and the lesson has finished processing."}},"required":["type","pageCount","pages"]},{"type":"object","properties":{"type":{"type":"string","enum":["stream"]},"kind":{"type":"string","enum":["stream"]},"playbackId":{"type":"string"},"customerCode":{"type":"string"}},"required":["type","kind","playbackId","customerCode"]},{"type":"object","properties":{"type":{"type":"string","enum":["processing"]},"status":{"type":"string","enum":["pending","processing","failed"]}},"required":["type","status"]}]},"Course":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"],"description":"Sanitised course description HTML. Private agend-storage references are never returned; embedded files that require enrolment are rendered as unavailable text."},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"difficulty":{"type":["string","null"]},"delivery_mode":{"type":["string","null"],"enum":["self_paced","live_online","in_person","blended"],"description":"Author-set course format (US-3.1). Null until an author sets it; never derived from sessions."},"image_url":{"type":["string","null"]},"instructor_name":{"type":["string","null"]},"instructor_avatar_url":{"type":["string","null"]},"lessons_count":{"type":["integer","null"]},"total_duration_minutes":{"type":["integer","null"],"description":"Raw duration; 0 or null is returned as-is. Any \"Self-paced\" fallback label is a consumer presentation concern."},"cpd_points":{"type":["number","null"]},"is_free":{"type":["boolean","null"]},"base_price":{"type":["number","null"],"description":"Standard price in dollars, GST-inclusive."},"member_price":{"type":["number","null"],"description":"Current member price in dollars, GST-inclusive. Null uses the standard price."},"published":{"type":"boolean"},"status":{"type":"string","enum":["draft","published","concluded","archived"],"description":"Lifecycle status of the course."},"owner_account_id":{"type":["string","null"],"format":"uuid"},"external_ref":{"type":["string","null"],"description":"Opaque identifier of the course counterpart in an external system of record. Null when the course has no external counterpart. Unique per account for non-null values; never parsed or validated by the platform."},"learning_outcomes":{"type":["array","null"],"items":{"type":"string"}},"prerequisites":{"type":["array","null"],"items":{"type":"string"}},"has_scheduled_sessions":{"type":["boolean","null"]},"session_access_only":{"type":["boolean","null"]},"access_duration_days":{"type":["integer","null"],"description":"Days of access granted per enrolment. Null means no time limit."},"access_countdown_type":{"type":["string","null"],"enum":["from_enrollment","from_first_access"],"description":"When the per-enrolment access countdown starts."},"access_expiry_behavior":{"type":["string","null"],"enum":["lockout","read_only","limited"],"description":"What happens to an enrolment when its access window lapses."},"end_date":{"type":["string","null"],"format":"date-time","description":"Course-level availability cutoff. The conclude job transitions the course to `concluded` when this passes; it does not revoke individual enrolments."},"progress_milestones":{"type":"array","items":{"type":"integer","minimum":1,"maximum":99},"description":"Progress percentages at which lms.enrollment.milestone webhook events fire. Default 25, 50, 75. 100 is reserved for lms.enrollment.completed."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"my_enrollment":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"progress":{"type":"object","properties":{"percentage":{"type":"number"},"completed":{"type":"boolean"},"completed_at":{"type":["string","null"]},"lessons_completed":{"type":"integer"},"total_lessons":{"type":"integer"}},"required":["percentage","completed","completed_at","lessons_completed","total_lessons"]},"enrolled_at":{"type":["string","null"]},"last_accessed_at":{"type":["string","null"]},"current_lesson_id":{"type":["string","null"],"format":"uuid"},"access_mode":{"type":["string","null"],"enum":["full","read_only","expired","pending"]},"access_expires_at":{"type":["string","null"]}},"required":["id","progress","enrolled_at","last_accessed_at","current_lesson_id","access_mode","access_expires_at"],"description":"Optional-identity enrichment (Decision 2.7): present on list items and the course detail when the caller supplies a valid member bearer token — the member enrolment with full progress, or null when the member is not enrolled. Absent for anonymous callers. Identity is carried only by the validated JWT, never a parameter."}},"required":["id","title","slug","description","category","topics","difficulty","delivery_mode","image_url","instructor_name","instructor_avatar_url","lessons_count","total_duration_minutes","cpd_points","is_free","base_price","member_price","published","status","owner_account_id","external_ref","learning_outcomes","prerequisites","has_scheduled_sessions","session_access_only","access_duration_days","access_countdown_type","access_expiry_behavior","end_date","progress_milestones","created_at","updated_at"]},"CourseDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"],"description":"Sanitised course description HTML. Private agend-storage references are never returned; embedded files that require enrolment are rendered as unavailable text."},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"difficulty":{"type":["string","null"]},"delivery_mode":{"type":["string","null"],"enum":["self_paced","live_online","in_person","blended"],"description":"Author-set course format (US-3.1). Null until an author sets it; never derived from sessions."},"image_url":{"type":["string","null"]},"instructor_name":{"type":["string","null"]},"instructor_avatar_url":{"type":["string","null"]},"lessons_count":{"type":["integer","null"]},"total_duration_minutes":{"type":["integer","null"],"description":"Raw duration; 0 or null is returned as-is. Any \"Self-paced\" fallback label is a consumer presentation concern."},"cpd_points":{"type":["number","null"]},"is_free":{"type":["boolean","null"]},"base_price":{"type":["number","null"],"description":"Standard price in dollars, GST-inclusive."},"member_price":{"type":["number","null"],"description":"Current member price in dollars, GST-inclusive. Null uses the standard price."},"published":{"type":"boolean"},"status":{"type":"string","enum":["draft","published","concluded","archived"],"description":"Lifecycle status of the course."},"owner_account_id":{"type":["string","null"],"format":"uuid"},"external_ref":{"type":["string","null"],"description":"Opaque identifier of the course counterpart in an external system of record. Null when the course has no external counterpart. Unique per account for non-null values; never parsed or validated by the platform."},"learning_outcomes":{"type":["array","null"],"items":{"type":"string"}},"prerequisites":{"type":["array","null"],"items":{"type":"string"}},"has_scheduled_sessions":{"type":["boolean","null"]},"session_access_only":{"type":["boolean","null"]},"access_duration_days":{"type":["integer","null"],"description":"Days of access granted per enrolment. Null means no time limit."},"access_countdown_type":{"type":["string","null"],"enum":["from_enrollment","from_first_access"],"description":"When the per-enrolment access countdown starts."},"access_expiry_behavior":{"type":["string","null"],"enum":["lockout","read_only","limited"],"description":"What happens to an enrolment when its access window lapses."},"end_date":{"type":["string","null"],"format":"date-time","description":"Course-level availability cutoff. The conclude job transitions the course to `concluded` when this passes; it does not revoke individual enrolments."},"progress_milestones":{"type":"array","items":{"type":"integer","minimum":1,"maximum":99},"description":"Progress percentages at which lms.enrollment.milestone webhook events fire. Default 25, 50, 75. 100 is reserved for lms.enrollment.completed."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"my_enrollment":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"progress":{"type":"object","properties":{"percentage":{"type":"number"},"completed":{"type":"boolean"},"completed_at":{"type":["string","null"]},"lessons_completed":{"type":"integer"},"total_lessons":{"type":"integer"}},"required":["percentage","completed","completed_at","lessons_completed","total_lessons"]},"enrolled_at":{"type":["string","null"]},"last_accessed_at":{"type":["string","null"]},"current_lesson_id":{"type":["string","null"],"format":"uuid"},"access_mode":{"type":["string","null"],"enum":["full","read_only","expired","pending"]},"access_expires_at":{"type":["string","null"]}},"required":["id","progress","enrolled_at","last_accessed_at","current_lesson_id","access_mode","access_expires_at"],"description":"Optional-identity enrichment (Decision 2.7): present on list items and the course detail when the caller supplies a valid member bearer token — the member enrolment with full progress, or null when the member is not enrolled. Absent for anonymous callers. Identity is carried only by the validated JWT, never a parameter."},"lessons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":["string","null"]},"type":{"type":["string","null"]},"duration_minutes":{"type":["integer","null"]},"order_index":{"type":"integer"},"is_preview":{"type":["boolean","null"]},"drip_enabled":{"type":"boolean"},"is_available":{"type":["boolean","null"]},"unlock_time":{"type":["string","null"]}},"required":["id","title","slug","type","duration_minutes","order_index","is_preview","drip_enabled","is_available","unlock_time"]}},"quiz":{"type":["object","null"],"additionalProperties":{}},"analytics":{"type":["object","null"],"additionalProperties":{}}},"required":["id","title","slug","description","category","topics","difficulty","delivery_mode","image_url","instructor_name","instructor_avatar_url","lessons_count","total_duration_minutes","cpd_points","is_free","base_price","member_price","published","status","owner_account_id","external_ref","learning_outcomes","prerequisites","has_scheduled_sessions","session_access_only","access_duration_days","access_countdown_type","access_expiry_behavior","end_date","progress_milestones","created_at","updated_at","lessons","quiz","analytics"]},"CourseLessons":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"course_title":{"type":"string"},"lessons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":["string","null"]},"type":{"type":["string","null"]},"duration_minutes":{"type":["integer","null"]},"order_index":{"type":"integer"},"is_preview":{"type":["boolean","null"]},"drip_enabled":{"type":"boolean"},"is_available":{"type":["boolean","null"]},"unlock_time":{"type":["string","null"]}},"required":["id","title","slug","type","duration_minutes","order_index","is_preview","drip_enabled","is_available","unlock_time"]}},"total_lessons":{"type":"integer"}},"required":["course_id","course_title","lessons","total_lessons"]},"LessonRow":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"type":{"type":"string"},"order_index":{"type":"integer"},"description":{"type":["string","null"]},"duration_minutes":{"type":["integer","null"]},"content_storage_path":{"type":["string","null"]},"drip_enabled":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","course_id","title","type","order_index","description","duration_minutes","content_storage_path","drip_enabled","created_at","updated_at"]},"AuthoringUploadAuthorisation":{"type":"object","properties":{"upload_id":{"type":"string","format":"uuid"},"transport":{"type":"string","enum":["resumable"]},"endpoint":{"type":"string","format":"uri"},"token":{"type":"string","minLength":1},"expires_at":{"type":"string","format":"date-time"},"intent_expires_at":{"type":"string","format":"date-time"},"headers":{"type":"object","properties":{"x-signature":{"type":"string","minLength":1},"x-upsert":{"type":"string","enum":["false"]}},"required":["x-signature","x-upsert"]},"metadata":{"type":"object","properties":{"bucketName":{"type":"string","enum":["course-files"]},"objectName":{"type":"string","minLength":1},"contentType":{"type":"string","enum":["video/mp4","video/quicktime","video/webm"]},"cacheControl":{"type":"string","enum":["3600"]}},"required":["bucketName","objectName","contentType","cacheControl"]}},"required":["upload_id","transport","endpoint","token","expires_at","intent_expires_at","headers","metadata"]},"AuthoringUploadStatus":{"type":"object","properties":{"upload_id":{"type":"string","format":"uuid"},"asset_id":{"type":["string","null"],"format":"uuid"},"lesson_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","enum":["pending","cancelled","expired","processing","ready","failed"]},"processing_status":{"type":["string","null"],"enum":["pending","uploading","processing","ready","failed"]},"dispatch_status":{"type":["string","null"],"enum":["pending","sent"]},"failure_reason":{"type":["string","null"]},"intent_expires_at":{"type":"string","format":"date-time"}},"required":["upload_id","asset_id","lesson_id","status","processing_status","dispatch_status","failure_reason","intent_expires_at"]},"CourseEnrollResult":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"enrolled_at":{"type":["string","null"],"format":"date-time"},"progress_percentage":{"type":"number"}},"required":["enrollment_id","user_id","course_id","enrolled_at","progress_percentage"]},"CourseLifecycleResult":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"status":{"type":"string","enum":["concluded","archived"]}},"required":["course_id","title","status"]},"CourseFromTemplateResult":{"type":"object","properties":{"course_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"}},"required":["course_id","slug","title"]},"QuizWithQuestions":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"passing_score":{"type":"number"},"max_attempts":{"type":["number","null"]},"time_limit_minutes":{"type":["number","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]},"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"quiz_id":{"type":"string","format":"uuid"},"question":{"type":"string"},"question_type":{"type":["string","null"]},"options":{},"order_index":{"type":"number"}},"required":["id","quiz_id","question","question_type","order_index"]}}},"required":["id","course_id","title","description","passing_score","max_attempts","time_limit_minutes","created_at","updated_at","questions"]},"Quiz":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"passing_score":{"type":"number"},"max_attempts":{"type":["number","null"]},"time_limit_minutes":{"type":["number","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]}},"required":["id","course_id","title","description","passing_score","max_attempts","time_limit_minutes","created_at","updated_at"]},"DeletedResult":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]},"Badge":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"badge_name":{"type":"string"},"badge_color":{"type":["string","null"]},"badge_image_url":{"type":["string","null"]},"is_public":{"type":"boolean"},"earned_at":{"type":"string"}},"required":["id","user_id","course_id","badge_name","badge_color","badge_image_url","is_public","earned_at"]},"RevokedResult":{"type":"object","properties":{"status":{"type":"string","enum":["revoked"]}},"required":["status"]},"LearningPath":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"difficulty":{"type":["string","null"]},"is_sequential":{"type":"boolean"},"published":{"type":"boolean"},"image_url":{"type":["string","null"]},"estimated_duration_hours":{"type":["integer","null"]},"owner_account_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":"string","format":"date-time"}},"required":["id","title","slug","description","difficulty","is_sequential","published","image_url","estimated_duration_hours","owner_account_id","created_at"]},"LearningPathDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"difficulty":{"type":["string","null"]},"is_sequential":{"type":"boolean"},"published":{"type":"boolean"},"image_url":{"type":["string","null"]},"estimated_duration_hours":{"type":["integer","null"]},"owner_account_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":"string","format":"date-time"},"courses":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["id","title","slug","description","difficulty","is_sequential","published","image_url","estimated_duration_hours","owner_account_id","created_at","courses"]},"PathEnrollResult":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"path_id":{"type":"string","format":"uuid"},"enrolled_at":{"type":["string","null"],"format":"date-time"},"progress_percentage":{"type":"number"},"completed_courses":{"type":"integer"}},"required":["enrollment_id","user_id","path_id","enrolled_at","progress_percentage","completed_courses"]},"PathProgress":{"type":"object","properties":{"path":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"difficulty":{"type":["string","null"]},"is_sequential":{"type":"boolean"},"estimated_duration_hours":{"type":["integer","null"]},"total_cpd_points":{"type":["number","null"]}},"required":["id","title","slug","description","difficulty","is_sequential","estimated_duration_hours","total_cpd_points"]},"enrollment":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"enrolled_at":{"type":["string","null"],"format":"date-time"},"progress_percentage":{"type":"number"},"courses_completed":{"type":"integer"},"completed":{"type":"boolean"},"completed_at":{"type":["string","null"],"format":"date-time"},"last_accessed_at":{"type":["string","null"],"format":"date-time"}},"required":["id","enrolled_at","progress_percentage","courses_completed","completed","completed_at","last_accessed_at"]},"courses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"order_index":{"type":"integer"},"is_optional":{"type":"boolean"},"is_unlocked":{"type":"boolean"},"enrollment":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"enrolled_at":{"type":["string","null"],"format":"date-time"},"progress_percentage":{"type":"number"},"completed":{"type":"boolean"},"completed_at":{"type":["string","null"],"format":"date-time"}},"required":["id","enrolled_at","progress_percentage","completed","completed_at"]}},"required":["id","title","slug","order_index","is_optional","is_unlocked","enrollment"]}},"next_course":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]}},"required":["id","title","slug","description"]},"summary":{"type":"object","properties":{"total_courses":{"type":"integer"},"completed_courses":{"type":"integer"},"in_progress_courses":{"type":"integer"},"locked_courses":{"type":"integer"},"progress_percentage":{"type":"number"},"estimated_time_remaining_minutes":{"type":"integer"}},"required":["total_courses","completed_courses","in_progress_courses","locked_courses","progress_percentage","estimated_time_remaining_minutes"]}},"required":["path","enrollment","courses","next_course","summary"]},"Enrollment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"progress":{"type":"object","properties":{"percentage":{"type":"number"},"completed":{"type":"boolean"},"completed_at":{"type":["string","null"],"format":"date-time"},"lessons_completed":{"type":"integer"},"total_lessons":{"type":"integer"}},"required":["percentage","completed","completed_at","lessons_completed","total_lessons"]},"enrolled_at":{"type":["string","null"],"format":"date-time"},"last_accessed_at":{"type":["string","null"],"format":"date-time"},"current_lesson_id":{"type":["string","null"],"format":"uuid"},"seat_license_id":{"type":["string","null"],"format":"uuid"},"first_accessed_at":{"type":["string","null"],"format":"date-time"},"access_expires_at":{"type":["string","null"],"format":"date-time"},"access_mode":{"type":["string","null"],"enum":["full","read_only","expired","pending"]},"expired_at":{"type":["string","null"],"format":"date-time"},"expiry_reason":{"type":["string","null"]},"course":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"difficulty":{"type":["string","null"]},"lessons_count":{"type":"integer"},"duration_minutes":{"type":["integer","null"]},"image_url":{"type":["string","null"]},"cpd_points":{"type":"number"}},"required":["id","title","slug","description","category","topics","difficulty","lessons_count","duration_minutes","image_url","cpd_points"]},"certificate":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"certificate_number":{"type":"string"},"issued_at":{"type":"string","format":"date-time"},"pdf_url":{"type":["string","null"]},"verification_code":{"type":"string"}},"required":["id","certificate_number","issued_at","pdf_url","verification_code"]}},"required":["id","course_id","user_id","contact_id","progress","enrolled_at","last_accessed_at","current_lesson_id","seat_license_id","first_accessed_at","access_expires_at","access_mode","expired_at","expiry_reason","course","certificate"]},"MyCourseEnrollmentResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Enrollment"}},"required":["success","data"]},"EnrollmentAccessStatus":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"has_access":{"type":"boolean"},"days_remaining":{"type":["integer","null"]},"expiry_behavior":{"type":["string","null"],"enum":["lockout","read_only","limited"]},"first_accessed_at":{"type":["string","null"],"format":"date-time"},"access_expires_at":{"type":["string","null"],"format":"date-time"},"access_mode":{"type":["string","null"],"enum":["full","read_only","expired","pending"]},"expired_at":{"type":["string","null"],"format":"date-time"},"expiry_reason":{"type":["string","null"]}},"required":["enrollment_id","course_id","user_id","has_access","days_remaining","expiry_behavior","first_accessed_at","access_expires_at","access_mode","expired_at","expiry_reason"]},"UserEnrollment":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"difficulty":{"type":["string","null"]},"image_url":{"type":["string","null"]},"instructor_name":{"type":["string","null"]},"total_duration_minutes":{"type":["integer","null"]},"lessons_count":{"type":["integer","null"]},"cpd_points":{"type":["number","null"]},"published":{"type":"boolean"}},"required":["id","title","slug","description","category","topics","difficulty","image_url","instructor_name","total_duration_minutes","lessons_count","cpd_points","published"]},"progress_percentage":{"type":["number","null"]},"completed":{"type":"boolean"},"completed_at":{"type":["string","null"],"format":"date-time"},"enrolled_at":{"type":["string","null"],"format":"date-time"},"last_accessed_at":{"type":["string","null"],"format":"date-time"},"current_lesson_id":{"type":["string","null"],"format":"uuid"},"lessons_completed":{"type":"integer"},"first_accessed_at":{"type":["string","null"],"format":"date-time"},"access_expires_at":{"type":["string","null"],"format":"date-time"},"access_mode":{"type":["string","null"],"enum":["full","read_only","expired","pending"]},"expired_at":{"type":["string","null"],"format":"date-time"},"expiry_reason":{"type":["string","null"]}},"required":["enrollment_id","course","progress_percentage","completed","completed_at","enrolled_at","last_accessed_at","current_lesson_id","lessons_completed","first_accessed_at","access_expires_at","access_mode","expired_at","expiry_reason"]},"UserProgress":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"courses":{"type":"array","items":{"type":"object","properties":{"enrollment_id":{"type":"string","format":"uuid"},"course":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"lessons_count":{"type":["integer","null"]},"total_duration_minutes":{"type":["integer","null"]}},"required":["id","title","slug","lessons_count","total_duration_minutes"]},"progress":{"type":"object","properties":{"percentage":{"type":"number"},"lessons_completed":{"type":"integer"},"total_lessons":{"type":"integer"},"completed":{"type":"boolean"},"completed_at":{"type":["string","null"],"format":"date-time"},"enrolled_at":{"type":["string","null"],"format":"date-time"},"last_accessed_at":{"type":["string","null"],"format":"date-time"},"time_spent_seconds":{"type":"integer"},"time_spent_formatted":{"type":"string"}},"required":["percentage","lessons_completed","total_lessons","completed","completed_at","enrolled_at","last_accessed_at","time_spent_seconds","time_spent_formatted"]},"current_lesson_id":{"type":["string","null"],"format":"uuid"},"lessons":{"type":"array","items":{"type":"object","properties":{"progress_id":{"type":"string","format":"uuid"},"lesson":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"type":{"type":["string","null"]},"duration_minutes":{"type":["integer","null"]},"order_index":{"type":"integer"}},"required":["id","title","type","duration_minutes","order_index"]},"status":{"type":"string"},"time_spent_seconds":{"type":["integer","null"]},"started_at":{"type":["string","null"],"format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"last_accessed_at":{"type":["string","null"],"format":"date-time"}},"required":["progress_id","lesson","status","time_spent_seconds","started_at","completed_at","last_accessed_at"]}}},"required":["enrollment_id","course","progress","current_lesson_id","lessons"]}},"summary":{"type":"object","properties":{"total_enrollments":{"type":"integer"},"completed_enrollments":{"type":"integer"},"in_progress_enrollments":{"type":"integer"},"total_time_spent_seconds":{"type":"integer"},"total_time_spent_formatted":{"type":"string"},"average_completion_rate":{"type":"number"}},"required":["total_enrollments","completed_enrollments","in_progress_enrollments","total_time_spent_seconds","total_time_spent_formatted","average_completion_rate"]}},"required":["user_id","courses","summary"]},"UserCpd":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"balance":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"total_points":{"type":"number"},"courses_completed":{"type":"integer"},"last_updated_at":{"type":"string","format":"date-time"}},"required":["user_id","total_points","courses_completed","last_updated_at"]},"awards":{"type":"array","items":{"type":"object","properties":{"award_id":{"type":"string","format":"uuid"},"course":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"image_url":{"type":["string","null"]}},"required":["id","title","slug","category","topics","image_url"]},"points":{"type":"number"},"awarded_at":{"type":"string","format":"date-time"},"certificate_url":{"type":["string","null"]},"badge_data":{},"enrollment":{"type":["object","null"],"properties":{"enrolled_at":{"type":["string","null"],"format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"}},"required":["enrolled_at","completed_at"]}},"required":["award_id","course","points","awarded_at","certificate_url","enrollment"]}},"badges":{"type":"array","items":{"type":"object","properties":{"badge_id":{"type":"string","format":"uuid"},"course":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"}},"required":["id","title","slug"]},"badge_name":{"type":"string"},"badge_color":{"type":["string","null"]},"badge_image_url":{"type":["string","null"]},"is_public":{"type":"boolean"},"earned_at":{"type":"string","format":"date-time"}},"required":["badge_id","course","badge_name","badge_color","badge_image_url","is_public","earned_at"]}},"summary":{"type":"object","properties":{"total_points":{"type":"number"},"total_awards":{"type":"integer"},"total_badges":{"type":"integer"},"courses_completed":{"type":"integer"}},"required":["total_points","total_awards","total_badges","courses_completed"]},"standard_target":{"type":["number","null"]},"effective_target":{"type":["number","null"]},"adjustment":{"type":["object","null"],"properties":{"reason_code":{"type":["string","null"]},"reason_label":{"type":["string","null"]},"type":{"type":"string","enum":["auto_prorata","manual_override","switch","crm_derived","crm_synced"]},"note":{"type":"string"}},"required":["reason_code","reason_label","type","note"]}},"required":["user_id","balance","awards","badges","summary","standard_target","effective_target","adjustment"]},"CertificateVerification":{"type":"object","properties":{"valid":{"type":"boolean"},"certificate":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"certificate_number":{"type":"string"},"course_title":{"type":"string"},"course_category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"issued_at":{"type":"string","format":"date-time"},"completion_date":{"type":"string","format":"date-time"},"cpd_points":{"type":"number"},"instructor_name":{"type":["string","null"]},"certificate_url":{"type":["string","null"]}},"required":["id","certificate_number","course_title","course_category","topics","issued_at","completion_date","cpd_points","instructor_name","certificate_url"]},"verified_at":{"type":"string","format":"date-time"}},"required":["valid","certificate","verified_at"]},"BadgeVerification":{"type":"object","properties":{"valid":{"type":"boolean"},"badge":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"badge_name":{"type":"string"},"badge_color":{"type":["string","null"]},"badge_image_url":{"type":["string","null"]},"earned_at":{"type":"string","format":"date-time"},"course":{"type":["object","null"],"properties":{"title":{"type":"string"},"slug":{"type":"string"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"cpd_points":{"type":"integer","minimum":0}},"required":["title","slug","category","topics","cpd_points"]},"earner":{"type":["object","null"],"properties":{"display_name":{"type":"string"}},"required":["display_name"]}},"required":["id","badge_name","badge_color","badge_image_url","earned_at","course","earner"]},"verified_at":{"type":"string","format":"date-time"}},"required":["valid","badge","verified_at"]},"CertificateGenerateResult":{"type":"object","properties":{"certificate_id":{"type":"string","format":"uuid"},"pdf_url":{"type":"string"},"already_generated":{"type":"boolean"},"generated_at":{"type":"string","format":"date-time"}},"required":["certificate_id","pdf_url"]},"LmsBlocksDiscovery":{"type":"object","properties":{"module":{"type":"string","enum":["lms"]},"blocks":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"config_schema":{"type":"object","additionalProperties":{}}},"required":["type","name","description","config_schema"]}}},"required":["module","blocks"]},"CreateCourseInput":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":2000},"slug":{"type":"string","minLength":3,"maxLength":100,"pattern":"^[a-z0-9-]+$"},"description":{"type":["string","null"],"maxLength":10000},"category":{"type":["string","null"],"maxLength":100,"description":"Deprecated and ignored. Send topic_ids instead.","deprecated":true},"topic_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50,"default":[]},"difficulty":{"type":["string","null"],"minLength":1,"maxLength":64,"pattern":"^[a-z0-9_-]+$"},"delivery_mode":{"type":["string","null"],"enum":["self_paced","live_online","in_person","blended"]},"image_url":{"type":["string","null"],"format":"uri"},"instructor_name":{"type":["string","null"],"maxLength":255},"instructor_avatar_url":{"type":["string","null"],"format":"uri"},"is_free":{"type":"boolean","default":true},"base_price":{"type":["number","null"],"minimum":0,"description":"Standard price in dollars, GST-inclusive."},"member_price":{"type":["number","null"],"minimum":0.5,"description":"Price charged to current members in dollars, GST-inclusive; minimum 0.50, at most two decimal places. Null uses the standard price."},"cpd_points":{"type":"number","minimum":0,"default":0},"learning_outcomes":{"type":"array","items":{"type":"string","maxLength":500},"maxItems":20,"default":[]},"prerequisites":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"has_scheduled_sessions":{"type":["boolean","null"]},"session_access_only":{"type":["boolean","null"]},"progress_milestones":{"type":"array","items":{"type":"integer","minimum":1,"maximum":99},"maxItems":20}},"required":["title","slug"]},"UpdateCourseInput":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":2000},"slug":{"type":"string","minLength":3,"maxLength":100,"pattern":"^[a-z0-9-]+$"},"description":{"type":["string","null"],"maxLength":10000},"category":{"type":["string","null"],"maxLength":100,"description":"Deprecated and ignored. Send topic_ids instead.","deprecated":true},"topic_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50,"default":[]},"difficulty":{"type":["string","null"],"minLength":1,"maxLength":64,"pattern":"^[a-z0-9_-]+$"},"delivery_mode":{"type":["string","null"],"enum":["self_paced","live_online","in_person","blended"]},"image_url":{"type":["string","null"],"format":"uri"},"instructor_name":{"type":["string","null"],"maxLength":255},"instructor_avatar_url":{"type":["string","null"],"format":"uri"},"is_free":{"type":"boolean","default":true},"base_price":{"type":["number","null"],"minimum":0,"description":"Standard price in dollars, GST-inclusive."},"member_price":{"type":["number","null"],"minimum":0.5,"description":"Price charged to current members in dollars, GST-inclusive; minimum 0.50, at most two decimal places. Null uses the standard price."},"cpd_points":{"type":"number","minimum":0,"default":0},"learning_outcomes":{"type":"array","items":{"type":"string","maxLength":500},"maxItems":20,"default":[]},"prerequisites":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"has_scheduled_sessions":{"type":["boolean","null"]},"session_access_only":{"type":["boolean","null"]},"progress_milestones":{"type":"array","items":{"type":"integer","minimum":1,"maximum":99},"maxItems":20},"published":{"type":"boolean"}}},"ReorderedResult":{"type":"object","properties":{"reordered":{"type":"boolean","enum":[true]}},"required":["reordered"]},"CreatePathInput":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":255},"slug":{"type":"string","minLength":3,"maxLength":255,"pattern":"^[a-z0-9-]+$"},"description":{"type":["string","null"],"maxLength":5000},"difficulty":{"type":["string","null"],"minLength":1,"maxLength":64,"pattern":"^[a-z0-9_-]+$"},"image_url":{"type":["string","null"],"format":"uri"},"is_sequential":{"type":["boolean","null"]},"estimated_duration_hours":{"type":["integer","null"],"minimum":0}},"required":["title","slug"]},"UpdatePathInput":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":255},"slug":{"type":"string","minLength":3,"maxLength":255,"pattern":"^[a-z0-9-]+$"},"description":{"type":["string","null"],"maxLength":5000},"difficulty":{"type":["string","null"],"minLength":1,"maxLength":64,"pattern":"^[a-z0-9_-]+$"},"image_url":{"type":["string","null"],"format":"uri"},"is_sequential":{"type":["boolean","null"]},"estimated_duration_hours":{"type":["integer","null"],"minimum":0},"published":{"type":"boolean"}}},"LoopThread":{"type":"object","properties":{"thread_id":{"type":"string","format":"uuid"},"channel_id":{"type":"string","format":"uuid"},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]},"content":{"type":"string"},"content_html":{"type":["string","null"]},"author":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"avatar":{"type":["string","null"]}},"required":["id","name","avatar"]},"reply_count":{"type":"integer"},"is_pinned":{"type":"boolean"},"is_reply":{"type":"boolean"},"parent_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"url":{"type":"string"}},"required":["thread_id","channel_id","channel","content","content_html","author","reply_count","is_pinned","is_reply","parent_id","created_at","updated_at","url"]},"LoopThreadActivity":{"type":"object","properties":{"thread_id":{"type":"string","format":"uuid"},"reply_count":{"type":"integer"},"participant_count":{"type":"integer"},"last_activity":{"type":"string","format":"date-time"},"recent_replies":{"type":"array","items":{"type":"object","additionalProperties":{}}},"top_contributors":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["thread_id","reply_count","participant_count","last_activity","recent_replies","top_contributors"]},"LoopBotsList":{"type":"object","properties":{"bots":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"avatar_url":{"type":["string","null"]},"description":{"type":["string","null"]},"type":{"type":"string"},"is_active":{"type":"boolean"},"metadata":{"type":"object","additionalProperties":{}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","name","avatar_url","description","type","is_active","metadata","created_at","updated_at"]}},"count":{"type":"integer"}},"required":["bots","count"]},"LoopBot":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"avatar_url":{"type":["string","null"]},"description":{"type":["string","null"]},"type":{"type":"string"},"is_active":{"type":"boolean"},"metadata":{"type":"object","additionalProperties":{}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","name","avatar_url","description","type","is_active","metadata","created_at","updated_at"]},"LoopBotMessage":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel_id":{"type":"string","format":"uuid"},"parent_id":{"type":["string","null"],"format":"uuid"},"bot_id":{"type":"string","format":"uuid"},"bot_name":{"type":"string"},"content":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"url":{"type":"string"}},"required":["id","channel_id","parent_id","bot_id","bot_name","content","created_at","url"]},"LoopMentions":{"type":"object","properties":{"contact_id":{"type":"string"},"user_id":{"type":"string","format":"uuid"},"mentions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"content":{"type":"string"},"content_html":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"is_thread_reply":{"type":"boolean"},"thread_id":{"type":"string","format":"uuid"},"reply_count":{"type":["integer","null"]},"is_pinned":{"type":["boolean","null"]},"channel":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"]},"author":{"type":["object","null"],"properties":{"display_name":{"type":["string","null"]},"avatar_url":{"type":["string","null"]}},"required":["display_name","avatar_url"]}},"required":["id","content","content_html","created_at","is_thread_reply","thread_id","reply_count","is_pinned","channel","author"]}},"has_more":{"type":"boolean"},"total":{"type":"integer"}},"required":["contact_id","user_id","mentions","has_more","total"]},"MyChannelsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"privacy":{"type":"string","enum":["public","private","secret"]},"channel_type":{"type":"string"},"is_archived":{"type":"boolean"},"member_count":{"type":"integer","minimum":0},"role":{"type":"string","enum":["owner","admin","moderator","member"]},"joined_at":{"type":"string","format":"date-time"},"last_read_at":{"type":["string","null"],"format":"date-time"}},"required":["id","name","slug","description","privacy","channel_type","is_archived","member_count","role","joined_at","last_read_at"]}}},"required":["success","data"]},"LoopChannelListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"privacy":{"type":"string","enum":["public","private","secret"]},"channel_type":{"type":"string"},"is_archived":{"type":"boolean"},"member_count":{"type":"integer","minimum":0}},"required":["id","slug","name","description","privacy","channel_type","is_archived","member_count"]},"LoopChannelStats":{"type":"object","properties":{"channel_id":{"type":"string","format":"uuid"},"channel_slug":{"type":"string"},"all_time":{"type":"object","properties":{"messages":{"type":"object","properties":{"total":{"type":"integer"}},"required":["total"]},"comments":{"type":"object","properties":{"total":{"type":"integer"},"threads":{"type":"integer"},"replies":{"type":"integer"}},"required":["total","threads","replies"]},"reactions":{"type":"object","properties":{"total":{"type":"integer"},"by_type":{"type":"object","properties":{"thumbs_up":{"type":"integer"},"heart":{"type":"integer"},"joy":{"type":"integer"},"open_mouth":{"type":"integer"},"slightly_frowning_face":{"type":"integer"},"tada":{"type":"integer"},"eyes":{"type":"integer"},"pray":{"type":"integer"}},"required":["thumbs_up","heart","joy","open_mouth","slightly_frowning_face","tada","eyes","pray"]}},"required":["total","by_type"]}},"required":["messages","comments","reactions"]},"current_month":{"type":"object","properties":{"messages":{"type":"object","properties":{"total":{"type":"integer"}},"required":["total"]},"comments":{"type":"object","properties":{"total":{"type":"integer"},"threads":{"type":"integer"},"replies":{"type":"integer"}},"required":["total","threads","replies"]},"reactions":{"type":"object","properties":{"total":{"type":"integer"},"by_type":{"type":"object","properties":{"thumbs_up":{"type":"integer"},"heart":{"type":"integer"},"joy":{"type":"integer"},"open_mouth":{"type":"integer"},"slightly_frowning_face":{"type":"integer"},"tada":{"type":"integer"},"eyes":{"type":"integer"},"pray":{"type":"integer"}},"required":["thumbs_up","heart","joy","open_mouth","slightly_frowning_face","tada","eyes","pray"]}},"required":["total","by_type"]}},"required":["messages","comments","reactions"]}},"required":["channel_id","channel_slug","all_time","current_month"]},"LoopUserActivity":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"stats":{"type":"object","properties":{"messages_count":{"type":"integer"},"threads_started":{"type":"integer"},"reactions_received":{"type":"integer"},"channels_active":{"type":"integer"}},"required":["messages_count","threads_started","reactions_received","channels_active"]},"recent_activity":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["thread","reply"]},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]},"thread_id":{"type":"string","format":"uuid"},"message_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"preview":{"type":"string"}},"required":["type","channel","thread_id","message_id","created_at","preview"]}}},"required":["user_id","stats","recent_activity"]},"LoopUserNotifications":{"type":"object","properties":{"unread_count":{"type":"integer"},"notifications":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string"},"title":{"type":"string"},"preview":{"type":"string"},"channel":{"type":"null"},"created_at":{"type":"string","format":"date-time"},"read":{"type":"boolean"},"url":{"type":"string"}},"required":["id","type","title","preview","channel","created_at","read","url"]}},"pagination":{"type":"object","properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}},"required":["total","limit","offset"]}},"required":["unread_count","notifications","pagination"]},"LoopPublicActivity":{"type":"object","properties":{"activity":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string"},"content":{"type":"string"},"reply_count":{"type":"integer"},"is_pinned":{"type":"boolean"},"is_featured":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"channel":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"type":{"type":["string","null"]}},"required":["id","slug","name","type"]},"author":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"display_name":{"type":["string","null"]},"avatar_url":{"type":["string","null"]}},"required":["id","display_name","avatar_url"]}},"required":["id","type","content","reply_count","is_pinned","is_featured","created_at","channel","author"]}},"channel_count":{"type":"integer"},"has_more":{"type":"boolean"}},"required":["activity","channel_count","has_more"]},"LoopPublicAnnouncements":{"type":"object","properties":{"announcements":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"content":{"type":"string"},"content_html":{"type":["string","null"]},"post_type":{"type":["string","null"]},"is_pinned":{"type":"boolean"},"is_featured":{"type":"boolean"},"reply_count":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"channel":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"]},"author":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"display_name":{"type":["string","null"]},"avatar_url":{"type":["string","null"]}},"required":["id","display_name","avatar_url"]}},"required":["id","content","content_html","post_type","is_pinned","is_featured","reply_count","created_at","channel","author"]}},"channels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]}},"required":["id","slug","name","description"]}}},"required":["announcements","channels"]},"LoopBlocksDiscovery":{"type":"object","properties":{"module":{"type":"string","enum":["loop"]},"blocks":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"config_schema":{"type":"object","additionalProperties":{}}},"required":["type","name","description","config_schema"]}}},"required":["module","blocks"]},"LoopMessage":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel_id":{"type":"string","format":"uuid"},"author_id":{"type":"string","format":"uuid"},"parent_id":{"type":["string","null"],"format":"uuid"},"content":{"type":"string"},"is_edited":{"type":"boolean"},"is_deleted":{"type":"boolean"},"reply_count":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}},"required":["id","channel_id","author_id","parent_id","content","is_edited","is_deleted","reply_count","created_at"]},"LoopDeletedResult":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]},"LoopAdminDeletedResult":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]},"originalAuthorId":{"type":"string","format":"uuid"},"channelId":{"type":"string","format":"uuid"}},"required":["status","originalAuthorId","channelId"]},"LoopUpdatedResult":{"type":"object","properties":{"status":{"type":"string","enum":["updated"]}},"required":["status"]},"LoopSyncedUser":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"email":{"type":"string"},"display_name":{"type":"string"},"avatar_url":{"type":"string"},"external_id":{"type":"integer"},"account_membership":{"type":"object","properties":{"role":{"type":"string"},"joined_at":{"type":"string"}},"required":["role","joined_at"]}},"required":["user_id","email","external_id"]},"LoopBulkSyncResult":{"type":"object","properties":{"total":{"type":"integer"},"succeeded":{"type":"integer"},"failed":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"integer"},"success":{"type":"boolean"},"user":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"email":{"type":"string"},"display_name":{"type":"string"},"avatar_url":{"type":"string"},"external_id":{"type":"integer"},"account_membership":{"type":"object","properties":{"role":{"type":"string"},"joined_at":{"type":"string"}},"required":["role","joined_at"]}},"required":["user_id","email","external_id"]},"error":{"type":"string"}},"required":["external_id","success"]}}},"required":["total","succeeded","failed","results"]},"LoopCommitteeListItem":{"type":"object","properties":{"unique_id":{"type":"string"},"name":{"type":"string"},"channel_id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"is_archived":{"type":"boolean"}},"required":["unique_id","name","channel_id","slug","is_archived"]},"LoopCommitteeSyncResult":{"type":"object","properties":{"committee":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"privacy":{"type":"string"},"channel_type":{"type":"string"},"is_archived":{"type":"boolean"},"member_count":{"type":"integer"}},"required":["id","name","slug","privacy","channel_type","is_archived"]},"created":{"type":"boolean"},"applied":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0},"removed":{"type":"integer","minimum":0},"skipped_external_ids":{"type":"array","items":{"type":"integer"}},"adopted":{"type":"integer","minimum":0},"adoption_results":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"integer"},"outcome":{"type":"string","enum":["adopted","already_managed","inserted","managed_elsewhere","held","not_in_roster","unresolved"],"description":"`adopted`: the existing membership is now managed by the sync. `already_managed`: the sync already managed it. `inserted`: the member had no membership and was added as a managed member. `managed_elsewhere`: an active group grant or Upbeat committee provenance manages the membership, so nothing was adopted. `held`: a Loop organisation administrator removed the member in an emergency and the removal hold is still active, so nothing was adopted or added; a member under a role cap can still be adopted and is capped. `not_in_roster`: the id is not in the request roster. `unresolved`: the id is in the roster but is not tied to exactly one Loop user through the SSO identity of the connection: it resolved to no user, only by email, or to more than one user, and nothing was adopted."}},"required":["external_id","outcome"]}},"held":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"integer","exclusiveMinimum":0,"description":"The id the SSO connection of the site knows the held member by, the same id the roster and `adopt_external_ids` carry."},"kind":{"type":"string","enum":["removal","role_cap"],"description":"`removal`: a Loop organisation administrator removed the member in an emergency, so the sync does not re-add them. `role_cap`: an administrator lowered the role of the member in an emergency, so the sync never raises them above `role_cap`."},"role_cap":{"type":["string","null"],"enum":["owner","admin","moderator","member"],"description":"The highest role the sync gives the member for a `role_cap` hold; `null` for a `removal` hold."},"reason":{"type":"string","description":"The reason the administrator gave, 1 to 500 characters, so the site can explain why the member is missing or capped."},"held_since":{"type":"string","format":"date-time","description":"When the hold was placed, as an ISO 8601 UTC instant."}},"required":["external_id","kind","role_cap","reason","held_since"]},"description":"The roster entries an active hold changed, empty when none did. A removal hold skips every entry of the member whole (nothing is added, promoted, demoted or adopted, and the entry is not counted in `applied`); a role cap lowers an entry that ranks above it to the cap. An entry at or below the cap is not listed. One item per resolved roster entry, by its `external_id`."}},"required":["committee","created","applied","skipped","removed","skipped_external_ids","adopted","adoption_results","held"]},"LoopMemberRefreshAccepted":{"type":"object","properties":{"status":{"type":"string","enum":["accepted"]}},"required":["status"]},"LoopMemberChannelPresence":{"type":"object","properties":{"in_active_channel":{"type":"boolean"},"resolved":{"type":"boolean"}},"required":["in_active_channel","resolved"]},"LoopCommittee":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"privacy":{"type":"string"},"channel_type":{"type":"string"},"is_archived":{"type":"boolean"},"member_count":{"type":"integer"}},"required":["id","name","slug","privacy","channel_type","is_archived"]},"LoopCommitteeMembers":{"type":"object","properties":{"unique_id":{"type":"string"},"members":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"integer","exclusiveMinimum":0,"description":"The id the SSO connection of the site knows the member by, the same id the roster and `adopt_external_ids` carry. A member holding several identities on the connection appears once under each."},"role":{"type":"string","enum":["owner","admin","moderator","member"],"description":"The current role of the member in the committee channel."},"managed_by":{"type":"string","enum":["wordpress_sync","group","upbeat","none"],"description":"What manages the membership. `wordpress_sync`: the WordPress sync inserted or adopted it, so the roster can demote or remove it. `group`: an active CRM group grant backs the channel and user. `upbeat`: Upbeat committee provenance backs the membership. `none`: nothing manages it, so the roster only promotes it. When more than one applies, the first in that order is reported."}},"required":["external_id","role","managed_by"]},"description":"Every committee member with an identity on the SSO connection of the site, by ascending `external_id`. Carries no name, email, avatar or Loop user id."},"unlinked_count":{"type":"integer","minimum":0,"description":"Committee members with no usable identity on the SSO connection of the site, counted but never listed. An identity whose external id is not a positive integer cannot be named by the sync routes, so it counts here. Bots are not counted."},"holds":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"integer","exclusiveMinimum":0,"description":"The id the SSO connection of the site knows the held member by, the same id the roster and `adopt_external_ids` carry."},"kind":{"type":"string","enum":["removal","role_cap"],"description":"`removal`: a Loop organisation administrator removed the member in an emergency, so the sync does not re-add them. `role_cap`: an administrator lowered the role of the member in an emergency, so the sync never raises them above `role_cap`."},"role_cap":{"type":["string","null"],"enum":["owner","admin","moderator","member"],"description":"The highest role the sync gives the member for a `role_cap` hold; `null` for a `removal` hold."},"reason":{"type":"string","description":"The reason the administrator gave, 1 to 500 characters, so the site can explain why the member is missing or capped."},"held_since":{"type":"string","format":"date-time","description":"When the hold was placed, as an ISO 8601 UTC instant."}},"required":["external_id","kind","role_cap","reason","held_since"]},"description":"Every active hold on the committee channel for a user with an identity on the SSO connection of the site, by ascending `external_id`, including a removal-held user who is no longer a member. A user holding several identities appears once under each. Carries no Loop user id."}},"required":["unique_id","members","unlinked_count","holds"]},"LoopCommitteeArchivedResult":{"type":"object","properties":{"status":{"type":"string","enum":["archived"]}},"required":["status"]},"LoopModeratorUpdatedResult":{"type":"object","properties":{"status":{"type":"string","enum":["updated"]}},"required":["status"]},"SiteConfig":{"type":"object","properties":{"account":{"type":"object","properties":{"slug":{"type":"string","minLength":1}},"required":["slug"],"additionalProperties":false},"brand":{"type":"object","properties":{"name":{"type":"string"},"full_name":{"type":["string","null"]},"tagline":{"type":["string","null"]},"logo_url":{"type":["string","null"]},"favicon_url":{"type":["string","null"]},"og_image_url":{"type":["string","null"]}},"required":["name","full_name","tagline","logo_url","favicon_url","og_image_url"],"additionalProperties":false},"theme":{"type":"object","properties":{"fonts":{"type":"object","properties":{"heading":{"type":["string","null"]},"body":{"type":["string","null"]}},"required":["heading","body"],"additionalProperties":false},"colors":{"type":"object","additionalProperties":{"type":"string"}}},"required":["fonts","colors"],"additionalProperties":false},"enabled_apps":{"type":"object","properties":{"events":{"type":"boolean"},"lms":{"type":"boolean"},"crm":{"type":"boolean"},"loop":{"type":"boolean"},"jobs":{"type":"boolean"},"directory":{"type":"boolean"},"atlas":{"type":"boolean"},"cart":{"type":"boolean"},"sites":{"type":"boolean"}},"required":["events","lms","crm","loop","jobs","directory","atlas","cart","sites"],"additionalProperties":false},"commerce":{"type":"object","properties":{"cart":{"type":"object","properties":{"checkout_mode":{"type":["string","null"],"enum":["direct","portal-handoff"]}},"required":["checkout_mode"],"additionalProperties":false}},"required":["cart"],"additionalProperties":false},"content":{"type":"object","properties":{"wordpress":{"type":"object","properties":{"mode":{"type":["string","null"],"enum":["local-import"]}},"required":["mode"],"additionalProperties":false}},"required":["wordpress"],"additionalProperties":false},"links":{"type":"object","properties":{"portal":{"type":"string","format":"uri"}},"required":["portal"],"additionalProperties":false}},"required":["account","brand","theme","enabled_apps","commerce","content","links"],"additionalProperties":false},"SiteConfigResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SiteConfig"}},"required":["success","data"]},"SsoConnection":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"default_landing_path":{"type":["string","null"]},"protocol":{"type":"string"},"connection_type":{"type":"string"},"is_active":{"type":"boolean"},"approval_state":{"type":"string","enum":["pending","approved"]},"jit_provisioning":{"type":"boolean"},"jit_contact_provisioning":{"type":"boolean"},"post_link_return_url":{"type":["string","null"]},"allow_idp_initiated":{"type":"boolean"},"idp_entity_id":{"type":"string"},"idp_sso_url":{"type":"string"},"name_id_format":{"type":["string","null"]},"idp_certificate_masked":{"type":"string"},"sp_entity_id":{"type":"string"},"sp_acs_url":{"type":"string"},"sp_metadata_url":{"type":["string","null"]},"allowed_domains":{"type":["array","null"],"items":{"type":"string"}},"default_role":{"type":["string","null"]},"attribute_mappings":{"type":["object","null"],"additionalProperties":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","slug","default_landing_path","protocol","connection_type","is_active","approval_state","jit_provisioning","jit_contact_provisioning","post_link_return_url","allow_idp_initiated","idp_entity_id","idp_sso_url","name_id_format","idp_certificate_masked","sp_entity_id","sp_acs_url","sp_metadata_url","allowed_domains","default_role","attribute_mappings","created_at","updated_at"]},"SsoConnectionList":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/SsoConnection"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},"SsoConnectionCreated":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SsoConnection"}},"required":["success","data"]},"SsoConnectionUpdated":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SsoConnection"}},"required":["success","data"]},"SsoConnectionDeleted":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}},"required":["status"]}},"required":["success","data"]},"SsoIdentityLinkStatus":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"linked":{"type":"boolean"},"user_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"}},"required":["linked"]}},"required":["success","data"]},"SsoMintedToken":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"},"access_token":{"type":"string"},"token_type":{"type":"string","enum":["bearer"]},"expires_at":{"type":"integer"}},"required":["user_id","contact_id","access_token","token_type","expires_at"]},"SsoIdentityLinkConfirmed":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"linked":{"type":"boolean","enum":[true]},"created":{"type":"boolean"},"user_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"}},"required":["linked","created","user_id","contact_id"]}},"required":["success","data"]},"SsoIdentityLinkResult":{"type":"object","properties":{"linked":{"type":"boolean","enum":[true]},"created":{"type":"boolean"},"user_id":{"type":"string","format":"uuid"},"contact_id":{"type":["string","null"],"format":"uuid"}},"required":["linked","created","user_id","contact_id"]},"SsoIdentityLinkCreated":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SsoIdentityLinkResult"}},"required":["success","data"]},"SsoOwnershipVerificationResponse":{"type":"object","properties":{"status":{"type":"string","enum":["verification_required"]},"message":{"type":"string","minLength":1}},"required":["status","message"]},"SsoIdentityLinkWithheld":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SsoOwnershipVerificationResponse"}},"required":["success","data"]},"UpbeatRecordRefresh":{"type":"object","properties":{"workflow_id":{"type":"string","format":"uuid"},"outcome":{"type":"string","enum":["run_requested","unchanged","not_in_feed","lookup_unconfirmed","lookup_failed","requested"],"description":"Always `requested`: the refresh was queued and runs asynchronously. The other values are retained for compatibility and are no longer returned."}},"required":["workflow_id","outcome"],"additionalProperties":false},"UpbeatRecordRefreshResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/UpbeatRecordRefresh"}}},"required":["success","data"]},"UpbeatRecordRefreshRequest":{"type":"object","properties":{"resource_path":{"type":"string","minLength":1,"maxLength":504},"lookup_value":{"type":"string","minLength":1,"maxLength":200}},"required":["resource_path","lookup_value"],"additionalProperties":false},"EmbedExchangeResponse":{"type":"object","properties":{"bootstrap_token":{"type":"string"},"expires_in":{"type":"integer"},"account_id":{"type":"string","format":"uuid"},"app":{"type":"string","enum":["lms","loop"]}},"required":["bootstrap_token","expires_in","account_id","app"]},"EmbedExchangeResponseEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EmbedExchangeResponse"}},"required":["success","data"]},"EmbedExchangeRequest":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"external_id":{"type":"string","minLength":1,"maxLength":255},"connection_id":{"type":"string","format":"uuid"},"app":{"type":"string","enum":["lms","loop"]}},"required":["account_id","external_id","app"]},"AgentChatRequest":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","additionalProperties":{}},"description":"AI-SDK UI message history for this turn."},"conversationId":{"type":"string","description":"Existing conversation to append to, if any."}},"required":["messages"]},"ProposalActionResult":{"type":"object","properties":{"workflowId":{"type":"string","description":"Workflow launched by an approved proposal."}}},"MobileOrganisationsData":{"anyOf":[{"type":"object","properties":{"eligible_organisations":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"logo_url":{"type":["string","null"],"format":"uri"},"brand_color":{"type":["string","null"]},"membership_id":{"type":"string","format":"uuid"},"access_state":{"type":"string","enum":["active","grace_period","renewal_required","blocked"]},"grace_ends_at":{"type":["string","null"],"format":"date-time"},"renewal_url":{"type":["string","null"],"format":"uri"},"support_url":{"type":["string","null"],"format":"uri"}},"required":["account_id","name","slug","logo_url","brand_color","membership_id","access_state","grace_ends_at","renewal_url","support_url"],"additionalProperties":false}},"recovery_organisations":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"logo_url":{"type":["string","null"],"format":"uri"},"brand_color":{"type":["string","null"]},"membership_id":{"type":"string","format":"uuid"},"access_state":{"type":"string","enum":["active","grace_period","renewal_required","blocked"]},"grace_ends_at":{"type":["string","null"],"format":"date-time"},"renewal_url":{"type":["string","null"],"format":"uri"},"support_url":{"type":["string","null"],"format":"uri"}},"required":["account_id","name","slug","logo_url","brand_color","membership_id","access_state","grace_ends_at","renewal_url","support_url"],"additionalProperties":false}}},"required":["eligible_organisations","recovery_organisations"],"description":"Default response when x-agend-mobile-contract is omitted: member-only organisations with non-null membership identifiers."},{"type":"object","properties":{"eligible_organisations":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"logo_url":{"type":["string","null"],"format":"uri"},"brand_color":{"type":["string","null"]},"membership_id":{"type":["string","null"],"format":"uuid"},"access_state":{"type":"string","enum":["active","grace_period","renewal_required","blocked"]},"grace_ends_at":{"type":["string","null"],"format":"date-time"},"renewal_url":{"type":["string","null"],"format":"uri"},"support_url":{"type":["string","null"],"format":"uri"},"profiles":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["member","staff"]},"membership_id":{"type":["string","null"],"format":"uuid"},"account_role":{"type":["string","null"],"minLength":1},"access_state":{"type":"string","enum":["active","grace_period","renewal_required","blocked"]},"grace_ends_at":{"type":["string","null"],"format":"date-time"}},"required":["type","membership_id","account_role","access_state","grace_ends_at"]},"minItems":1}},"required":["account_id","name","slug","logo_url","brand_color","membership_id","access_state","grace_ends_at","renewal_url","support_url","profiles"]}},"recovery_organisations":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"logo_url":{"type":["string","null"],"format":"uri"},"brand_color":{"type":["string","null"]},"membership_id":{"type":["string","null"],"format":"uuid"},"access_state":{"type":"string","enum":["active","grace_period","renewal_required","blocked"]},"grace_ends_at":{"type":["string","null"],"format":"date-time"},"renewal_url":{"type":["string","null"],"format":"uri"},"support_url":{"type":["string","null"],"format":"uri"},"profiles":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["member","staff"]},"membership_id":{"type":["string","null"],"format":"uuid"},"account_role":{"type":["string","null"],"minLength":1},"access_state":{"type":"string","enum":["active","grace_period","renewal_required","blocked"]},"grace_ends_at":{"type":["string","null"],"format":"date-time"}},"required":["type","membership_id","account_role","access_state","grace_ends_at"]},"minItems":1}},"required":["account_id","name","slug","logo_url","brand_color","membership_id","access_state","grace_ends_at","renewal_url","support_url","profiles"]}}},"required":["eligible_organisations","recovery_organisations"],"description":"Opt-in response for x-agend-mobile-contract: 2. Includes explicit member and staff profiles; staff-only organisations have a null membership_id."}]},"MobileOrganisationsResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/MobileOrganisationsData"}},"required":["success","data"]},"MobileSessionData":{"anyOf":[{"type":"object","properties":{"access_token":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"organisation":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"logo_url":{"type":["string","null"],"format":"uri"},"brand_color":{"type":["string","null"]},"membership_id":{"type":"string","format":"uuid"},"access_state":{"type":"string","enum":["active","grace_period","renewal_required","blocked"]},"grace_ends_at":{"type":["string","null"],"format":"date-time"},"renewal_url":{"type":["string","null"],"format":"uri"},"support_url":{"type":["string","null"],"format":"uri"}},"required":["account_id","name","slug","logo_url","brand_color","membership_id","access_state","grace_ends_at","renewal_url","support_url"],"additionalProperties":false}},"required":["access_token","expires_at","organisation"],"description":"Default member session response when x-agend-mobile-contract is omitted."},{"type":"object","properties":{"access_token":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"organisation":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"logo_url":{"type":["string","null"],"format":"uri"},"brand_color":{"type":["string","null"]},"membership_id":{"type":["string","null"],"format":"uuid"},"access_state":{"type":"string","enum":["active","grace_period","renewal_required","blocked"]},"grace_ends_at":{"type":["string","null"],"format":"date-time"},"renewal_url":{"type":["string","null"],"format":"uri"},"support_url":{"type":["string","null"],"format":"uri"},"profiles":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["member","staff"]},"membership_id":{"type":["string","null"],"format":"uuid"},"account_role":{"type":["string","null"],"minLength":1},"access_state":{"type":"string","enum":["active","grace_period","renewal_required","blocked"]},"grace_ends_at":{"type":["string","null"],"format":"date-time"}},"required":["type","membership_id","account_role","access_state","grace_ends_at"]},"minItems":1}},"required":["account_id","name","slug","logo_url","brand_color","membership_id","access_state","grace_ends_at","renewal_url","support_url","profiles"]}},"required":["access_token","expires_at","organisation"],"description":"Opt-in response for x-agend-mobile-contract: 2. The requested profile determines the session authority; staff sessions have a null membership_id."}]},"MobileSessionResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/MobileSessionData"}},"required":["success","data"]},"MobileSessionRevocationData":{"type":"object","properties":{"revoked":{"type":"boolean","enum":[true]}},"required":["revoked"]},"MobileSessionRevocationResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/MobileSessionRevocationData"}},"required":["success","data"]}},"parameters":{}},"paths":{"/v1/webhooks/subscriptions":{"get":{"tags":["Webhooks: Management"],"summary":"List webhook subscriptions","description":"List all subscriptions for the account derived from the API key. Secrets are never returned — rotate to obtain a fresh one.","security":[{"apiKey":["webhooks.subscriptions.read"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (1-based)."},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50,"description":"Results per page."},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Subscriptions returned","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookSubscription"}},"meta":{"type":"object","properties":{"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"total_pages":{"type":"integer"},"has_next":{"type":"boolean"},"has_prev":{"type":"boolean"}},"required":["page","limit","total","total_pages","has_next","has_prev"]}},"required":["pagination"]}},"required":["success","data"]}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}},"403":{"description":"API key lacks webhooks.subscriptions.read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}}}},"post":{"tags":["Webhooks: Management"],"summary":"Create a webhook subscription","description":"Create a subscription. The response includes the signing secret exactly once. Store it immediately — the only way to recover a lost secret is via the rotate-secret endpoint.","security":[{"apiKey":["webhooks.subscriptions.manage"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookSubscriptionBody"}}}},"responses":{"201":{"description":"Subscription created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/WebhookSubscriptionWithSecret"}},"required":["success","data"]}}}},"400":{"description":"Validation failed (invalid URL, SSRF target, etc.)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}}}}},"/v1/webhooks/subscriptions/{id}":{"get":{"tags":["Webhooks: Management"],"summary":"Get a webhook subscription","security":[{"apiKey":["webhooks.subscriptions.read"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Subscription id (uuid)."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Subscription returned","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/WebhookSubscription"}},"required":["success","data"]}}}},"404":{"description":"Subscription not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}}}},"patch":{"tags":["Webhooks: Management"],"summary":"Update a webhook subscription","description":"Partial update. Any combination of url, description, events, active.","security":[{"apiKey":["webhooks.subscriptions.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Subscription id (uuid)."},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWebhookSubscriptionBody"}}}},"responses":{"200":{"description":"Subscription updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/WebhookSubscription"}},"required":["success","data"]}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}},"404":{"description":"Subscription not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}}}},"delete":{"tags":["Webhooks: Management"],"summary":"Delete a webhook subscription","description":"Hard-delete the subscription and cascade its delivery history. There is no undo — use disable (PATCH active=false) if you only want to pause.","security":[{"apiKey":["webhooks.subscriptions.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Subscription id (uuid)."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Subscription deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/WebhookSubscriptionDeletedResult"}},"required":["success","data"]}}}},"404":{"description":"Subscription not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}}}}},"/v1/webhooks/subscriptions/{id}/rotate-secret":{"post":{"tags":["Webhooks: Management"],"summary":"Rotate the signing secret","description":"Generate a new signing secret and invalidate the previous one immediately. The new secret is returned in the response and is the only chance to capture it.","security":[{"apiKey":["webhooks.subscriptions.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Subscription id (uuid)."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Secret rotated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/WebhookRotateSecretResult"}},"required":["success","data"]}}}},"404":{"description":"Subscription not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}}}}},"/v1/webhooks/subscriptions/{id}/test":{"post":{"tags":["Webhooks: Management"],"summary":"Send a test delivery","description":"Synchronously POST a `webhook.test` envelope to the subscription URL. Bypasses the outbox — useful for verifying URL configuration without waiting for a real event.","security":[{"apiKey":["webhooks.subscriptions.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Subscription id (uuid)."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Test attempted. Inspect `ok`, `status`, and `error` to see whether the subscriber accepted it.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/WebhookTestResult"}},"required":["success","data"]}}}},"404":{"description":"Subscription not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}}}}},"/v1/webhooks/deliveries":{"get":{"tags":["Webhooks: Management"],"summary":"List delivery attempts","description":"List the most recent delivery attempts across all subscriptions for the account. Use the optional `subscription_id` and `status` query params to narrow.","security":[{"apiKey":["webhooks.deliveries.read"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"subscription_id","in":"query"},{"schema":{"type":"string","enum":["pending","pending_retry","delivered","failed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (1-based)."},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50,"description":"Results per page."},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Deliveries returned","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"meta":{"type":"object","properties":{"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"total_pages":{"type":"integer"},"has_next":{"type":"boolean"},"has_prev":{"type":"boolean"}},"required":["page","limit","total","total_pages","has_next","has_prev"]}},"required":["pagination"]}},"required":["success","data"]}}}}}}},"/v1/webhooks/deliveries/{id}/replay":{"post":{"tags":["Webhooks: Management"],"summary":"Replay a delivery","description":"Re-queue a single delivery so the dispatcher tries it again on the next tick. Inserts a fresh delivery row; the original failure row is preserved for audit.","security":[{"apiKey":["webhooks.deliveries.replay"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Delivery id (uuid)."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Replay scheduled","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/WebhookReplayResult"}},"required":["success","data"]}}}},"404":{"description":"Delivery not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookApiError"}}}}}}},"/v1/auth/login":{"post":{"summary":"Sign in an existing contact","description":"Exchanges email and password for Supabase tokens only when the account contact holds verified ownership of its email. Valid credentials for an unverified contact return 202 with `verification_required`; the platform emails a single-use link and returns no session. When the authenticated user has no contact on the API key account, a pre-existing unlinked contact for the email is adopted automatically (single-organisation, provenance-gated) or a fresh contact is provisioned, if the account allows self-registration; when self-registration is disabled the login fails with generic invalid credentials (SPEC-CORE-20260722, SPEC-CORE-20260724, SPEC-CRM-20260831 US-3.5). A match withheld to an administrator claim (multi-organisation, shared/role mailbox, or provisioned cross-organisation) returns `link_status: \"pending_claim\"` with `contact: null`; otherwise `link_status: \"linked\"`. The returned `access_token` can be used as `Authorization: Bearer <jwt>` against any /v1/** route that requires user auth. The 202 verification branch applies to an unverified contact only when the account requires email verification (`account_auth_settings.require_email_verification`); an account that has turned the requirement off returns a session for an unverified contact instead. A contact whose address is `undeliverable` (a confirmed hard bounce) always receives the 202 branch, on either policy value (SPEC-CORE-20260915-account-email-verification-policy).","tags":["Auth"],"security":[{"apiKey":["auth.sessions.create"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginBody"}}}},"responses":{"200":{"description":"Sign-in succeeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginEnvelope"}}}},"202":{"description":"Credentials accepted; email ownership verification or MFA is required. MFA returns status mfa_required, an opaque mfa_token valid for five minutes and verified TOTP factors only, with no session or bearer tokens. Email ownership gates run first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingLoginEnvelope"}}}},"400":{"description":"Request body failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"User is not a contact of the API key account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/auth/mfa/verify":{"post":{"summary":"Complete a password login with a verified TOTP code","description":"Requires auth.sessions.create. Restores the withheld password session and upgrades it to aal2 without minting a replacement session. The opaque mfa_token is bound to the API key account, expires after five minutes and is single-use. Only verified TOTP factors are accepted. Five wrong codes exhaust the token. This operation has a separate rate-limit bucket of 10 requests per minute.","tags":["Auth"],"security":[{"apiKey":["auth.sessions.create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyMfaBody"}}}},"responses":{"200":{"description":"Sign-in succeeded with an aal2 session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginEnvelope"}}}},"400":{"description":"Request body failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"INVALID_MFA_TOKEN: token consumed, expired, exhausted or from another account; INVALID_MFA_CODE: incorrect code or factor; API key missing or invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"API key lacks the required scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"MFA verification rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/auth/register":{"post":{"summary":"Create a new contact and a Supabase user","description":"Creates an `auth.users` row plus a matching `crm_contacts` row on the API key account. A pre-existing unlinked contact for the email on the API key account is adopted rather than refused (SPEC-CORE-20260724), including a contact that holds an active membership or seat, but only while every matching contact at the address has unverified email ownership and the account requires email verification (`account_auth_settings.require_email_verification`); the registration pre-confirms the email, so the email verification requirement then withholds the session until the mailbox is proved. A match that holds a verified email, or an account that does not require email verification, is instead withheld to an administrator claim (`link_status: \"pending_claim\"`, `contact: null`), as is every such match when the account turns on `account_auth_settings.review_entitled_signups` (off by default). Rejected with `SELF_REGISTRATION_DISABLED` when the account has opted out of self-registration. `redirect_to` (used for the email-confirmation link) must be present in the API key `redirect_url_allowlist`. The response adds `link_status`: `\"linked\"` when a contact was created or adopted and bound to the user, `\"pending_claim\"` when the match was withheld to an administrator claim, and `null` on the invitation signup path (no contact created here). `contact` is `null` exactly when `link_status` is `\"pending_claim\"` or `null`. An email that already has an account elsewhere on the platform receives this identical success response (`contact: null`, `session: null`, `link_status: \"pending_claim\"` or `null`) rather than a distinguishing error, since `auth.users.email` is unique platform-wide and a distinct response would disclose the address has an Agend login somewhere on the platform to a caller holding only a minimally-scoped key (SPEC-API-20260810 US-4.4). The documented 409 is retained for contract compatibility; the platform-wide-duplicate case resolves to the success response above rather than the 409. Registration for a contact whose email ownership is not yet verified returns 201 with `session: null` and `pending_email_confirmation: true`, and a single-use verification link is emailed in the same request; the next login for that contact returns 202 `verification_required` until the link is accepted (SPEC-CORE-20260907-wordpress-email-verification-handling). A verified adopted contact still receives a session with `pending_email_confirmation: false`. The withheld-session branch applies to an unverified contact only when the account requires email verification (`account_auth_settings.require_email_verification`); an account that has turned the requirement off receives a session and `pending_email_confirmation: false` for an unverified contact instead. A contact whose address is `undeliverable` (a confirmed hard bounce) always has its session withheld, on either policy value (SPEC-CORE-20260915-account-email-verification-policy).","tags":["Auth"],"security":[{"apiKey":["auth.users.register"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterBody"}}}},"responses":{"201":{"description":"Registration succeeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterEnvelope"}}}},"400":{"description":"Validation failure, weak password, or redirect not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Self-registration disabled for this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Email already registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"The account requires email ownership verification but the verification email could not be sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/auth/refresh":{"post":{"summary":"Exchange a refresh_token for a new access_token","description":"Refreshes a Supabase session and re-checks the contact still exists on the API key account. A revoked contact row immediately breaks refresh; the access_token returned by login otherwise outlives the contact until natural expiry.","tags":["Auth"],"security":[{"apiKey":["auth.sessions.refresh"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshBody"}}}},"responses":{"200":{"description":"Refresh succeeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshEnvelope"}}}},"400":{"description":"Request body failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Refresh token is invalid, expired, or no longer scoped to the account. MFA_REQUIRED: an aal1 session for a user holding a verified factor is revoked; sign in again and complete MFA.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/auth/logout":{"post":{"summary":"Revoke the bearer user session globally","description":"Requires both the API key and a valid `Authorization: Bearer <jwt>`. Revokes every refresh token for the authenticated user. Returns `{ status: \"ok\" }` on success.","tags":["Auth"],"security":[{"apiKey":["auth.sessions.delete"],"userBearer":[]}],"responses":{"200":{"description":"Sessions revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogoutEnvelope"}}}},"401":{"description":"API key is missing, invalid, or inactive","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"API key lacks the required scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/auth/session-handoff":{"post":{"summary":"Mint a single-use portal sign-in link for the bearer user","description":"Requires both the API key (scope `auth.sessions.handoff`) and a valid `Authorization: Bearer <jwt>`. Mints a single-use magic-link token for the authenticated member and returns a portal `/auth/confirm` URL. Following that URL establishes the shared session cookie and lands the member on the portal.\n\nThe request body is optional. Omit it to land on the API key account's portal home (`/home/{slug}`, the default). Send `{\"destination\": \"checkout\"}` to land on the account checkout instead — the typical flow after `POST /v1/cart/transfer` has moved a guest cart onto the authenticated member.\n\nThe destination is derived server-side from a closed enum: the portal origin resolves from the API key account and the path from `destination`. No redirect URL, path, hostname, or account identifier is accepted from the caller.\n\nWhen the caller's contact on the target account does not hold verified email ownership, the hand-off is refused: no link carrying `ownership_account_id` is minted (a click from a bearer session is not mailbox evidence), a single-use ownership verification link is emailed instead, and the response is 202 `verification_required` (SPEC-CORE-20260907-wordpress-email-verification-handling). This refusal applies to an unverified contact only when the account requires email verification (`account_auth_settings.require_email_verification`); an account that has turned the requirement off receives the hand-off for an unverified contact instead. A contact whose address is `undeliverable` (a confirmed hard bounce) is always refused, on either policy value (SPEC-CORE-20260915-account-email-verification-policy).","tags":["Auth"],"security":[{"apiKey":["auth.sessions.handoff"],"userBearer":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionHandoffBody"}}}},"responses":{"200":{"description":"Hand-off link minted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionHandoffEnvelope"}}}},"202":{"description":"Verified email ownership is required before the hand-off link can be minted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnershipVerificationEnvelope"}}}},"400":{"description":"Request body failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"API key or bearer token is missing or invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"API key lacks the required scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"The account requires email ownership verification but the verification email could not be sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/auth/resend-verification":{"post":{"summary":"Request a fresh email ownership verification link","description":"Requires the API key (scope `auth.sessions.create`). Always returns 202 with the same message whether or not `email` matches an unverified, user-linked contact on the API key account, a verified contact, or no contact at all — the response never discloses which (response-uniformity.md). Rate limited to a fixed hourly budget per email address for each API key account, so one organisation cannot use up the budget of another; exceeding it returns 429 and sends nothing.","tags":["Auth"],"security":[{"apiKey":["auth.sessions.create"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendVerificationBody"}}}},"responses":{"202":{"description":"Verification link sent if a matching unverified contact exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnershipVerificationEnvelope"}}}},"400":{"description":"Request body failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per-email resend rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"The account requires email ownership verification but the verification email could not be sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/auth/forgot-password":{"post":{"summary":"Initiate password recovery for an existing contact","description":"Sends a password recovery link when a verified `crm_contacts` row exists on the API key account. When the contact exists but is unverified, sends the verified-email ownership link first and continues to password setup after verification. When the matching user cannot change their sign-in yet (an unconfirmed single sign-on link, or an account an organisation created that nobody has claimed), sends an Agend email confirmation in place of the recovery link. Every email goes from the Agend platform address, and the recovery link always lands on the Agend member portal. Returns `{ status: \"ok\" }` regardless of match, verification or lock state so cross-tenant enumeration is not possible. `redirect_to` is deprecated and ignored: it is still accepted, so existing callers keep working, but it no longer changes the link and is no longer checked against the API key `redirect_url_allowlist`.","tags":["Auth"],"security":[{"apiKey":["auth.passwords.reset"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPasswordBody"}}}},"responses":{"200":{"description":"Recovery request accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPasswordEnvelope"}}}},"400":{"description":"Validation failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/auth/reset-password":{"post":{"summary":"Complete password recovery with the email-link token","description":"Verifies the recovery token (the `token_hash` parameter Supabase appends to the redirect URL) and updates the password. Returns `{ status: \"ok\" }` on success. Refused with 400 `SIGN_IN_CHANGES_LOCKED` when the user must first confirm their email address through the Agend confirmation email; the password is unchanged and the recovery session is ended.","tags":["Auth"],"security":[{"apiKey":["auth.passwords.reset"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordBody"}}}},"responses":{"200":{"description":"Password reset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordEnvelope"}}}},"400":{"description":"Validation failure, weak password, or SIGN_IN_CHANGES_LOCKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Token is invalid or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"PASSWORD_RESET_UNAVAILABLE: the reset could not be completed; nothing was changed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/auth/change-password":{"post":{"summary":"Change the authenticated user's password","description":"Requires both the API key and a valid `Authorization: Bearer <jwt>`. Re-verifies the current password before updating. Returns `{ status: \"ok\" }` on success.","tags":["Auth"],"security":[{"apiKey":["auth.passwords.update"],"userBearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordBody"}}}},"responses":{"200":{"description":"Password updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordEnvelope"}}}},"400":{"description":"Request body failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Current password is incorrect or bearer is missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/me/pages/{id}/images/{imageId}":{"get":{"tags":["Atlas"],"summary":"Get an image used by a member-visible published page","description":"Streams authorised image bytes. Supports the page operation's API-key/bearer or mobile-session modes and the Portal image-only bearer transport with X-Account-Id. No redirect or signed URL is returned. Only non-hidden sections of the currently published version authorise bytes.","security":[{"apiKey":["atlas.pages.browse"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]},{"supabaseBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"imageId","in":"path"}],"responses":{"200":{"description":"Private, non-cacheable image bytes","content":{"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/png":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}},"image/gif":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"MISSING_API_KEY, INVALID_FORMAT, INVALID_KEY, MISSING_USER_TOKEN, INVALID_USER_TOKEN, MISSING_MOBILE_TOKEN or INVALID_MOBILE_SESSION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"402":{"description":"SUBSCRIPTION_REQUIRED: the organisation's subscription does not include Atlas","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"APP_NOT_ALLOWED, INSUFFICIENT_SCOPES, NOT_ACCOUNT_MEMBER, FORBIDDEN (the API key is not a unified key, or the request is not available to mobile sessions), or CORS_ORIGIN_DENIED (the request origin is not permitted by the API key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource not found or not visible to the member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/documents":{"get":{"tags":["Atlas"],"summary":"List Atlas source documents","description":"Returns source documents and their topics for the API key's account. Requires the `atlas.documents.browse` scope. Sunset notice: deprecated `category` and `tags` fields are compatibility projections of `topics` and will be removed in a future API version; use `topics`.","security":[{"apiKey":["atlas.documents.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","enum":["draft","in_review","published","archived"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"Paginated Atlas source documents","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"lineage_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["source_doc"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","in_review","published","archived"]},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"revision_type":{"type":["string","null"],"enum":["major","minor"]},"change_reason":{"type":["string","null"]},"supersedes":{"type":["string","null"],"format":"uuid"},"superseded_by":{"type":["string","null"],"format":"uuid"},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"review_interval_months":{"type":["integer","null"],"exclusiveMinimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"published_at":{"type":["string","null"],"format":"date-time"},"archived_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","lineage_id","kind","title","description","status","version_major","version_minor","revision_type","change_reason","supersedes","superseded_by","space_id","category","tags","topics","review_interval_months","last_reviewed_date","created_at","updated_at","published_at","archived_at"],"additionalProperties":false}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Document not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Atlas"],"summary":"Create an Atlas source document","description":"Creates a draft source document in the API key's account. Requires the `atlas.documents.create` scope. Sunset notice: deprecated `category` and `tags` fields are compatibility projections of `topics` and will be removed in a future API version; use `topics`.","security":[{"apiKey":["atlas.documents.create"]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"description":{"type":["string","null"],"maxLength":2000},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"minLength":1,"maxLength":100,"description":"Deprecated and ignored. Send topic_ids instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100},"maxItems":50,"description":"Deprecated and ignored. Send topic_ids instead.","deprecated":true},"topic_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50,"default":[]},"review_interval_months":{"type":["integer","null"],"minimum":1,"maximum":120}},"required":["title"],"additionalProperties":false}}}},"responses":{"201":{"description":"Atlas source document created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"lineage_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["source_doc"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","in_review","published","archived"]},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"revision_type":{"type":["string","null"],"enum":["major","minor"]},"change_reason":{"type":["string","null"]},"supersedes":{"type":["string","null"],"format":"uuid"},"superseded_by":{"type":["string","null"],"format":"uuid"},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"review_interval_months":{"type":["integer","null"],"exclusiveMinimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"published_at":{"type":["string","null"],"format":"date-time"},"archived_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","lineage_id","kind","title","description","status","version_major","version_minor","revision_type","change_reason","supersedes","superseded_by","space_id","category","tags","topics","review_interval_months","last_reviewed_date","created_at","updated_at","published_at","archived_at"],"additionalProperties":false}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Document not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/documents/{id}":{"get":{"tags":["Atlas"],"summary":"Get an Atlas source document","description":"Returns an account-scoped source document. A foreign or missing id returns the same 404 response. Requires the `atlas.documents.browse` scope. Sunset notice: deprecated `category` and `tags` fields are compatibility projections of `topics` and will be removed in a future API version; use `topics`.","security":[{"apiKey":["atlas.documents.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"Atlas source document","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"lineage_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["source_doc"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","in_review","published","archived"]},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"revision_type":{"type":["string","null"],"enum":["major","minor"]},"change_reason":{"type":["string","null"]},"supersedes":{"type":["string","null"],"format":"uuid"},"superseded_by":{"type":["string","null"],"format":"uuid"},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"review_interval_months":{"type":["integer","null"],"exclusiveMinimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"published_at":{"type":["string","null"],"format":"date-time"},"archived_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","lineage_id","kind","title","description","status","version_major","version_minor","revision_type","change_reason","supersedes","superseded_by","space_id","category","tags","topics","review_interval_months","last_reviewed_date","created_at","updated_at","published_at","archived_at"],"additionalProperties":false}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Document not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["Atlas"],"summary":"Update an Atlas source document","description":"Updates an account-scoped draft source document. A foreign or missing id returns the same 404 response. Requires the `atlas.documents.update` scope. Sunset notice: deprecated `category` and `tags` fields are compatibility projections of `topics` and will be removed in a future API version; use `topics`.","security":[{"apiKey":["atlas.documents.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"description":{"type":["string","null"],"maxLength":2000},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"minLength":1,"maxLength":100,"description":"Deprecated and ignored. Send topic_ids instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100},"maxItems":50,"description":"Deprecated and ignored. Send topic_ids instead.","deprecated":true},"topic_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50},"review_interval_months":{"type":["integer","null"],"minimum":1,"maximum":120}},"additionalProperties":false}}}},"responses":{"200":{"description":"Atlas source document updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"lineage_id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["source_doc"]},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","in_review","published","archived"]},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"revision_type":{"type":["string","null"],"enum":["major","minor"]},"change_reason":{"type":["string","null"]},"supersedes":{"type":["string","null"],"format":"uuid"},"superseded_by":{"type":["string","null"],"format":"uuid"},"space_id":{"type":["string","null"],"format":"uuid"},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"review_interval_months":{"type":["integer","null"],"exclusiveMinimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"published_at":{"type":["string","null"],"format":"date-time"},"archived_at":{"type":["string","null"],"format":"date-time"}},"required":["id","account_id","lineage_id","kind","title","description","status","version_major","version_minor","revision_type","change_reason","supersedes","superseded_by","space_id","category","tags","topics","review_interval_months","last_reviewed_date","created_at","updated_at","published_at","archived_at"],"additionalProperties":false}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Document not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/collections":{"get":{"tags":["Atlas"],"summary":"List Atlas collections","description":"Returns a paginated window of collections and their topics for the API key's account. Requires the `atlas.collections.browse` scope.","security":[{"apiKey":["atlas.collections.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"Paginated Atlas collections","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"item_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["id","title","description","topics","item_count","created_at","updated_at"],"additionalProperties":false}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Collection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/collections/{id}":{"get":{"tags":["Atlas"],"summary":"Get an Atlas collection","description":"Returns an account-scoped collection. A foreign or missing id returns the same 404 response. Requires the `atlas.collections.browse` scope.","security":[{"apiKey":["atlas.collections.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"Atlas collection","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"item_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["id","title","description","topics","item_count","created_at","updated_at"],"additionalProperties":false}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Collection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/search":{"get":{"tags":["Atlas"],"summary":"Search Atlas content","description":"Searches the caller-visible Atlas corpus. A supplied bearer selects that member or staff view; an API key alone selects the public view. Pagination total is the number of hits returned for the capped retrieval limit, not the corpus count. Requires the `atlas.pages.search` scope. Mobile callers use the ordinary bearer plus an organisation-scoped mobile session and always receive their member view.","security":[{"apiKey":["atlas.pages.search"]},{"apiKey":["atlas.pages.search"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":500},"required":true,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Paginated Atlas search hits","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"char_start":{"type":["integer","null"]},"char_end":{"type":["integer","null"]},"excerpt":{"type":"string"},"score":{"type":["number","null"]}},"required":["chunk_id","document_id","document_version_id","document_title","document_kind","version_major","version_minor","last_reviewed_date","section_id","page_number","char_start","char_end","excerpt","score"],"additionalProperties":false}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"MISSING_API_KEY, INVALID_FORMAT, INVALID_KEY, MISSING_USER_TOKEN, INVALID_USER_TOKEN, MISSING_MOBILE_TOKEN or INVALID_MOBILE_SESSION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"402":{"description":"SUBSCRIPTION_REQUIRED: the organisation's subscription does not include Atlas","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"APP_NOT_ALLOWED, INSUFFICIENT_SCOPES, NOT_ACCOUNT_MEMBER, FORBIDDEN (the API key is not a unified key, or the request is not available to mobile sessions), or CORS_ORIGIN_DENIED (the request origin is not permitted by the API key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/ask":{"post":{"tags":["Atlas"],"summary":"Ask Atlas a question","description":"Answers from the caller-visible Atlas corpus. Every question draws from the tenant's single monthly token pool. A key without a bearer asks over the public view. Requires the `atlas.questions.create` scope.","security":[{"apiKey":["atlas.questions.create"]},{"apiKey":["atlas.questions.create"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string","description":"Optional member or staff bearer token"},"required":false,"name":"authorization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string","minLength":1,"maxLength":2000},"scope_document_lineage_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":20}},"required":["question"],"additionalProperties":false}}}},"responses":{"200":{"description":"Answer, refusal, entitlement decision or degradation","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["answer"]},"answer":{"type":"string"},"citations":{"type":"array","items":{"type":"object","properties":{"marker":{"type":"integer","exclusiveMinimum":0},"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"char_start":{"type":["integer","null"]},"char_end":{"type":["integer","null"]},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["marker","chunk_id","document_id","document_version_id","section_id","page_number","char_start","char_end","document_title","document_kind","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}},"confidence":{"type":"string","enum":["high","low"]},"disclaimer":{"type":"string"}},"required":["kind","answer","citations","confidence","disclaimer"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["refusal"]},"message":{"type":"string"},"disclaimer":{"type":"string"}},"required":["kind","message","disclaimer"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["not_entitled"]},"tier":{"type":"string","enum":["free","starter","professional","enterprise"]},"reason":{"type":"string","enum":["no_subscription","tier_insufficient","trial_expired","subscription_cancelled"]}},"required":["kind","tier","reason"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["degraded"]},"message":{"type":"string"},"search_results":{"type":"array","items":{"type":"object","properties":{"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"snippet":{"type":"string"}},"required":["chunk_id","document_id","document_version_id","document_title","document_kind","version_major","version_minor","section_id","page_number","snippet"],"additionalProperties":false}},"contact_path":{"type":["string","null"]}},"required":["kind","message","search_results","contact_path"],"additionalProperties":false}]}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes or account membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/ask/budget":{"get":{"tags":["Atlas"],"summary":"Get the Atlas Ask budget","description":"Returns the current tenant-wide monthly Ask token budget. A supplied bearer selects that member or staff view; an API key alone selects the public view. Requires the `atlas.questions.browse` scope.","security":[{"apiKey":["atlas.questions.browse"]},{"apiKey":["atlas.questions.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string","description":"Optional member or staff bearer token"},"required":false,"name":"authorization","in":"header"}],"responses":{"200":{"description":"Current Atlas Ask budget","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"month_start":{"type":"string","format":"date"},"base_cap_tokens":{"type":"integer","minimum":0},"topup_tokens":{"type":"integer","minimum":0},"cap_tokens":{"type":"integer","minimum":0},"used_tokens":{"type":"integer","minimum":0},"remaining_tokens":{"type":"integer","minimum":0},"projected_month_end_tokens":{"type":"integer","minimum":0},"alert_thresholds_pct":{"type":"array","items":{"type":"integer","minimum":0,"maximum":100}},"crossed_thresholds_pct":{"type":"array","items":{"type":"integer","minimum":0,"maximum":100}},"exhausted":{"type":"boolean"}},"required":["month_start","base_cap_tokens","topup_tokens","cap_tokens","used_tokens","remaining_tokens","projected_month_end_tokens","alert_thresholds_pct","crossed_thresholds_pct","exhausted"],"additionalProperties":false}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes or account membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/me/collections":{"get":{"tags":["Atlas"],"summary":"List member-visible Atlas collections","description":"Returns collections and ordered pages visible to the authenticated member. Requires the `atlas.collections.browse` scope. Legacy callers use an API key plus a member bearer token; mobile callers use the ordinary bearer plus an organisation-scoped mobile session.","security":[{"apiKey":["atlas.collections.browse"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"responses":{"200":{"description":"Member-visible Atlas collections","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"items":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"position":{"type":"integer","minimum":0}},"required":["page_id","title","position"],"additionalProperties":false}}},"required":["id","title","description","topics","items"],"additionalProperties":false}}},"required":["success","data"]}}}},"401":{"description":"MISSING_API_KEY, INVALID_FORMAT, INVALID_KEY, MISSING_USER_TOKEN, INVALID_USER_TOKEN, MISSING_MOBILE_TOKEN or INVALID_MOBILE_SESSION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"402":{"description":"SUBSCRIPTION_REQUIRED: the organisation's subscription does not include Atlas","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"APP_NOT_ALLOWED, INSUFFICIENT_SCOPES, NOT_ACCOUNT_MEMBER, FORBIDDEN (the API key is not a unified key, or the request is not available to mobile sessions), or CORS_ORIGIN_DENIED (the request origin is not permitted by the API key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource not found or not visible to the member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/me/tree":{"get":{"tags":["Atlas"],"summary":"Get the member-visible Atlas navigation tree","description":"Returns the spaces, standalone pages and collections visible to the authenticated member. Only published pages the member may read appear, each with its version and last review date. Page arrays remain flat in parent-before-child order and include visible display parents and zero-based sibling positions. Collection membership and curated order are unchanged. Requires the `atlas.pages.browse` scope. Legacy callers use an API key plus a member bearer token; mobile callers use the ordinary bearer plus an organisation-scoped mobile session.","security":[{"apiKey":["atlas.pages.browse"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"responses":{"200":{"description":"Member-visible Atlas navigation tree","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"spaces":{"type":"array","items":{"type":"object","properties":{"space_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"pages":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"parent_page_id":{"type":["string","null"],"format":"uuid"},"position":{"type":"integer","minimum":0},"title":{"type":"string"},"space_id":{"type":["string","null"],"format":"uuid"},"version_major":{"type":["integer","null"],"minimum":0},"version_minor":{"type":["integer","null"],"minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["page_id","parent_page_id","position","title","space_id","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}}},"required":["space_id","name","pages"],"additionalProperties":false}},"ungrouped_pages":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"parent_page_id":{"type":["string","null"],"format":"uuid"},"position":{"type":"integer","minimum":0},"title":{"type":"string"},"space_id":{"type":["string","null"],"format":"uuid"},"version_major":{"type":["integer","null"],"minimum":0},"version_minor":{"type":["integer","null"],"minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["page_id","parent_page_id","position","title","space_id","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}},"collections":{"type":"array","items":{"type":"object","properties":{"collection_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"parent_page_id":{"type":["string","null"],"format":"uuid"},"position":{"type":"integer","minimum":0},"title":{"type":"string"},"space_id":{"type":["string","null"],"format":"uuid"},"version_major":{"type":["integer","null"],"minimum":0},"version_minor":{"type":["integer","null"],"minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["page_id","parent_page_id","position","title","space_id","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}}},"required":["collection_id","title","items"],"additionalProperties":false}}},"required":["spaces","ungrouped_pages","collections"],"additionalProperties":false}},"required":["success","data"]}}}},"401":{"description":"MISSING_API_KEY, INVALID_FORMAT, INVALID_KEY, MISSING_USER_TOKEN, INVALID_USER_TOKEN, MISSING_MOBILE_TOKEN or INVALID_MOBILE_SESSION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"402":{"description":"SUBSCRIPTION_REQUIRED: the organisation's subscription does not include Atlas","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"APP_NOT_ALLOWED, INSUFFICIENT_SCOPES, NOT_ACCOUNT_MEMBER, FORBIDDEN (the API key is not a unified key, or the request is not available to mobile sessions), or CORS_ORIGIN_DENIED (the request origin is not permitted by the API key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/me/pages/{id}":{"get":{"tags":["Atlas"],"summary":"Get a member-visible Atlas page","description":"Returns a published page visible to the authenticated member. Each section contains rendered HTML; an img names /v1/atlas/me/pages/{id}/images/{imageId}, which requires the same bearer. A page outside the member visibility set and a missing page return the same 404 response. Requires the `atlas.pages.browse` scope. Legacy callers use an API key plus a member bearer token; mobile callers use the ordinary bearer plus an organisation-scoped mobile session. Sunset notice: deprecated `category` and `tags` fields are compatibility projections of `topics` and will be removed in a future API version; use `topics`.","security":[{"apiKey":["atlas.pages.browse"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Member-visible Atlas page","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"page_id":{"type":"string","format":"uuid"},"page_version_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"space_id":{"type":["string","null"],"format":"uuid"},"space_name":{"type":["string","null"]},"category":{"type":["string","null"],"description":"Deprecated subject label retained during the topics migration. Use topics instead.","deprecated":true},"tags":{"type":"array","items":{"type":"string"},"description":"Deprecated subject labels retained during the topics migration. Use topics instead.","deprecated":true},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","slug","name","canonical_topic_id"]}},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"},"next_review_date":{"type":["string","null"],"format":"date"},"published_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"content":{"type":"string"},"display_order":{"type":"integer","minimum":0}},"required":["id","title","content","display_order"],"additionalProperties":false}}},"required":["page_id","page_version_id","title","description","space_id","space_name","category","tags","topics","version_major","version_minor","last_reviewed_date","next_review_date","published_at","updated_at","sections"],"additionalProperties":false}},"required":["success","data"]}}}},"400":{"description":"Invalid page id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"MISSING_API_KEY, INVALID_FORMAT, INVALID_KEY, MISSING_USER_TOKEN, INVALID_USER_TOKEN, MISSING_MOBILE_TOKEN or INVALID_MOBILE_SESSION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"402":{"description":"SUBSCRIPTION_REQUIRED: the organisation's subscription does not include Atlas","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"APP_NOT_ALLOWED, INSUFFICIENT_SCOPES, NOT_ACCOUNT_MEMBER, FORBIDDEN (the API key is not a unified key, or the request is not available to mobile sessions), or CORS_ORIGIN_DENIED (the request origin is not permitted by the API key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource not found or not visible to the member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/me/ask":{"post":{"tags":["Atlas"],"summary":"Ask Atlas as a member","description":"Answers only from content visible to the authenticated member. Every question draws from the tenant's single monthly token pool. Requires the `atlas.questions.create` scope. Legacy callers use an API key plus a member bearer token; mobile callers use the ordinary bearer plus an organisation-scoped mobile session. Mobile sessions are limited to 10 questions per minute per user; API-key callers keep the gateway default limit per key.","security":[{"apiKey":["atlas.questions.create"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string","minLength":1,"maxLength":2000},"scope_document_lineage_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":20}},"required":["question"],"additionalProperties":false}}}},"responses":{"200":{"description":"Answer, refusal, entitlement decision or degradation","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["answer"]},"answer":{"type":"string"},"citations":{"type":"array","items":{"type":"object","properties":{"marker":{"type":"integer","exclusiveMinimum":0},"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"char_start":{"type":["integer","null"]},"char_end":{"type":["integer","null"]},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"last_reviewed_date":{"type":["string","null"],"format":"date"}},"required":["marker","chunk_id","document_id","document_version_id","section_id","page_number","char_start","char_end","document_title","document_kind","version_major","version_minor","last_reviewed_date"],"additionalProperties":false}},"confidence":{"type":"string","enum":["high","low"]},"disclaimer":{"type":"string"}},"required":["kind","answer","citations","confidence","disclaimer"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["refusal"]},"message":{"type":"string"},"disclaimer":{"type":"string"}},"required":["kind","message","disclaimer"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["not_entitled"]},"tier":{"type":"string","enum":["free","starter","professional","enterprise"]},"reason":{"type":"string","enum":["no_subscription","tier_insufficient","trial_expired","subscription_cancelled"]}},"required":["kind","tier","reason"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["degraded"]},"message":{"type":"string"},"search_results":{"type":"array","items":{"type":"object","properties":{"chunk_id":{"type":"string","format":"uuid"},"document_id":{"type":"string","format":"uuid"},"document_version_id":{"type":"string","format":"uuid"},"document_title":{"type":"string"},"document_kind":{"type":"string"},"version_major":{"type":"integer","minimum":0},"version_minor":{"type":"integer","minimum":0},"section_id":{"type":["string","null"],"format":"uuid"},"page_number":{"type":["integer","null"]},"snippet":{"type":"string"}},"required":["chunk_id","document_id","document_version_id","document_title","document_kind","version_major","version_minor","section_id","page_number","snippet"],"additionalProperties":false}},"contact_path":{"type":["string","null"]}},"required":["kind","message","search_results","contact_path"],"additionalProperties":false}]}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"MISSING_API_KEY, INVALID_FORMAT, INVALID_KEY, MISSING_USER_TOKEN, INVALID_USER_TOKEN, MISSING_MOBILE_TOKEN or INVALID_MOBILE_SESSION","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"402":{"description":"SUBSCRIPTION_REQUIRED: the organisation's subscription does not include Atlas","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"APP_NOT_ALLOWED, INSUFFICIENT_SCOPES, NOT_ACCOUNT_MEMBER, FORBIDDEN (the API key is not a unified key, or the request is not available to mobile sessions), or CORS_ORIGIN_DENIED (the request origin is not permitted by the API key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"RATE_LIMIT_EXCEEDED: more than 10 questions in a minute from one mobile session user, or the API key exceeded the gateway limit. Retry after the Retry-After interval","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/pages":{"post":{"tags":["Atlas"],"summary":"Create a draft Atlas page from Markdown; a person publishes it in Atlas","description":"Converts a Markdown body, with optional YAML front matter, into a new page in the API key's organisation, one section per level-two heading. The page is always created as a draft: no API operation publishes it, and publishing is done by a person in Atlas. Submit it for review with POST /v1/atlas/pages/{lineageId}/submit. Front-matter topics are matched to existing topics by name or alias and never created; a topic that is not assigned is named in warnings. Runs with the API key alone; a bearer token, when supplied, records that user as the page's author. Requires the `atlas.pages.create` scope.","security":[{"apiKey":["atlas.pages.create"]},{"apiKey":["atlas.pages.create"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string","description":"Optional bearer token of a member of the API key's organisation. When supplied, the page records that user as its author."},"required":false,"name":"authorization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"markdown":{"type":"string","minLength":1,"description":"The page as Markdown, optionally opening with YAML front matter (title, visibility, space or space_id, topics). At most 1,048,576 bytes of UTF-8; a larger value is rejected with 413."},"space_id":{"type":"string","format":"uuid","description":"Space to create the page in. Overrides the front matter's space_id and space. With no space named anywhere, the page is created with no space."},"visibility":{"type":"string","enum":["space_default","public","members","entitlements","staff"],"description":"Overrides the front matter's visibility.level. space_default writes no page rule, so the space's own default applies. entitlements takes its required entitlements from the front matter."},"title":{"type":"string","minLength":1,"maxLength":500,"description":"Overrides the front-matter title, the first level-one heading and every other title source."}},"required":["markdown"],"additionalProperties":false}}}},"responses":{"201":{"description":"Draft Atlas page created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"lineage_id":{"type":"string","format":"uuid"},"version_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"status":{"type":"string","enum":["draft"]},"section_count":{"type":"integer","exclusiveMinimum":0},"warnings":{"type":"array","items":{"type":"string"},"description":"Human-readable import warnings, such as a front-matter topic that was not assigned or markup the sanitiser removed. Empty when there are none."}},"required":["lineage_id","version_id","title","status","section_count","warnings"],"additionalProperties":false}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or INVALID_USER_TOKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"INSUFFICIENT_SCOPES, MISSING_USER_OR_ELEVATED_SCOPE, or NOT_ACCOUNT_MEMBER","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"PAGE_MARKDOWN_TOO_LARGE: the markdown field exceeds 1,048,576 bytes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"PAGE_IMPORT_REJECTED: invalid front matter or visibility, no title, a space not found in the organisation, or more than 200 sections","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/atlas/pages/{lineageId}/submit":{"post":{"tags":["Atlas"],"summary":"Submit a draft Atlas page for review","description":"Moves the current draft of a page in the API key's organisation to in review, where a person reviews and publishes it in Atlas; no API operation publishes a page. A page whose current version is already in review or published returns 409. A page in another organisation and a missing page return the same 404 response. Runs with the API key alone; a bearer token is optional. Requires the `atlas.pages.submit` scope.","security":[{"apiKey":["atlas.pages.submit"]},{"apiKey":["atlas.pages.submit"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Lineage id of the page, as returned in lineage_id when the page was created."},"required":true,"name":"lineageId","in":"path"},{"schema":{"type":"string","minLength":1,"description":"Agend API key"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string","description":"Optional member or staff bearer token"},"required":false,"name":"authorization","in":"header"}],"responses":{"200":{"description":"Atlas page submitted for review","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"lineage_id":{"type":"string","format":"uuid"},"version_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["in_review"]}},"required":["lineage_id","version_id","status"],"additionalProperties":false}},"required":["success","data"]}}}},"400":{"description":"Invalid page lineage id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or INVALID_USER_TOKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"INSUFFICIENT_SCOPES, MISSING_USER_OR_ELEVATED_SCOPE, or NOT_ACCOUNT_MEMBER","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"PAGE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"PAGE_NOT_DRAFT: the current version is already in review or published. PAGE_NOT_API_DRAFT: the current draft was not created through the API, or a person has since revised or edited it, so the API may not submit it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/discount":{"post":{"tags":["Cart"],"summary":"Apply a discount code before payment","description":"Guests must supply guest_buyer (buyer name and email) when applying; a missing guest_buyer returns the same validation error as checkout without spending a refusal. Event-ticket-only and course-only carts. Course codes must cover every course; codes with neither course nor membership scope remain event-ticket-only. Cart-shape refusals return \"This discount code does not apply to the items in your cart.\" before code lookup. Unknown and out-of-scope codes both return \"This discount code is not valid.\" Returns a server-computed discount quote with per-line allocations and post-discount GST. Applying stores the code but creates no checkout attempt, reservation or usage. Checkout rechecks the stored code; send accepted_quote_version from this quote to refuse a stale review. Refused applies share checkout budgets: 5 per cart, 20 per signed-in buyer, and 200 per API key per 10 minutes. Guests have only the cart and API-key budgets. Limited requests return RATE_LIMITED before any code-dependent work. Reloads recompute the stored quote; an invalid stored code remains visible with applies=false and full pricing.","security":[{"apiKey":["cart.items.manage"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"discount_code":{"type":"string","minLength":1,"maxLength":100},"guest_buyer":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","maxLength":254,"format":"email"}},"required":["name","email"]}},"required":["discount_code"],"additionalProperties":false}}}},"responses":{"200":{"description":"Current discount quote","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"code":{"type":["string","null"]},"applies":{"type":"boolean"},"refusal_message":{"type":["string","null"]},"version":{"type":"string"},"undiscounted_total_cents":{"type":"integer","minimum":0},"discount_cents":{"type":"integer","minimum":0},"subtotal_cents":{"type":"integer","minimum":0},"tax_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0},"show_gst":{"type":"boolean"},"lines":{"type":"array","items":{"type":"object","properties":{"cart_item_id":{"type":"string","format":"uuid"},"discount_cents":{"type":"integer","minimum":0},"subtotal_cents":{"type":"integer","minimum":0},"tax_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0},"tax_treatment":{"type":"string","enum":["taxable","gst_free","input_taxed"]}},"required":["cart_item_id","discount_cents","subtotal_cents","tax_cents","total_cents","tax_treatment"]}}},"required":["code","applies","refusal_message","version","undiscounted_total_cents","discount_cents","subtotal_cents","tax_cents","total_cents","show_gst","lines"]}},"required":["success","data"]}}}},"400":{"description":"Invalid input or INVALID_DISCOUNT_CODE; messages match checkout.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Cart not found (including an inaccessible cart).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Cart changed; review again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Shared discount refusal budget exhausted, or gateway request budget exhausted.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string","enum":["RATE_LIMITED"]},"message":{"type":"string","enum":["Too many discount code attempts. Try again in a few minutes."]}},"required":["code","message"]}},"required":["success","error"]},{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string","enum":["RATE_LIMIT_EXCEEDED"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}]}}}}}},"delete":{"tags":["Cart"],"summary":"Remove the stored discount code","description":"Removes the stored code and returns full-price totals and line amounts. Add-on accepted annual commitments and instalment schedules remain unchanged; add-on and mixed add-on carts cannot apply additional cart discounts. Removal does not evaluate a code or check or spend discount refusal budgets. Remove a non-applying stored code before paying. Returns MISSING_SESSION when no cart identity is supplied.","security":[{"apiKey":["cart.items.manage"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"responses":{"200":{"description":"Current discount quote","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"code":{"type":["string","null"]},"applies":{"type":"boolean"},"refusal_message":{"type":["string","null"]},"version":{"type":"string"},"undiscounted_total_cents":{"type":"integer","minimum":0},"discount_cents":{"type":"integer","minimum":0},"subtotal_cents":{"type":"integer","minimum":0},"tax_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0},"show_gst":{"type":"boolean"},"lines":{"type":"array","items":{"type":"object","properties":{"cart_item_id":{"type":"string","format":"uuid"},"discount_cents":{"type":"integer","minimum":0},"subtotal_cents":{"type":"integer","minimum":0},"tax_cents":{"type":"integer","minimum":0},"total_cents":{"type":"integer","minimum":0},"tax_treatment":{"type":"string","enum":["taxable","gst_free","input_taxed"]}},"required":["cart_item_id","discount_cents","subtotal_cents","tax_cents","total_cents","tax_treatment"]}}},"required":["code","applies","refusal_message","version","undiscounted_total_cents","discount_cents","subtotal_cents","tax_cents","total_cents","show_gst","lines"]}},"required":["success","data"]}}}},"400":{"description":"MISSING_SESSION: no authenticated contact or guest cart session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Cart not found (including an inaccessible cart).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Cart changed; review again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/add-ons":{"get":{"tags":["Cart"],"summary":"Quote eligible membership add-ons for the authenticated contact","description":"Requires cart.items.manage and a verified Supabase bearer identifying a CRM contact in the API key account, or an internal authenticated session. A contact does not need a team-account role; the gateway checks the live session, account scope and contact email ownership before resolving the contact. Guest tokens and caller-supplied contact ids cannot authorise this catalogue. Eligibility and prices are computed server-side.","security":[{"apiKey":["cart.items.manage"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","enum":["full","instalments"]},"required":false,"name":"paymentChoice","in":"query"},{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for API-key callers acting on behalf of a logged-in user. Ignored in session mode."},"required":false,"name":"Authorization","in":"header"}],"responses":{"200":{"description":"Authoritative add-on quotes with contracted totals, due today and dated future payments; quote_version must be accepted when adding a selected payment choice.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"payment_default_policy":{"type":["object","null"],"properties":{"version":{"type":"string","format":"uuid"},"confirmedAt":{"type":"string","format":"date-time"},"graceDays":{"type":"integer","minimum":0,"maximum":365},"suspendAction":{"type":"string","enum":["suspend","hold"]},"restoreAllowed":{"type":"boolean"}},"required":["version","confirmedAt","graceDays","suspendAction","restoreAllowed"]},"product_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"product_kind":{"type":"string","enum":["insurance","general"]},"display_labels":{"type":"object","properties":{"singular":{"type":["string","null"]},"plural":{"type":["string","null"]},"priceLabel":{"type":["string","null"]},"termLabel":{"type":["string","null"]},"certificateLabel":{"type":["string","null"]}},"additionalProperties":false},"quote_version":{"type":"string"},"term_start":{"type":"string","format":"date"},"end_date":{"type":"string","format":"date"},"renewal_boundary":{"type":"string","format":"date"},"annual_reference_price_cents":{"type":"integer","minimum":0},"contracted_total_cents":{"type":"integer","minimum":0},"subtotal_cents":{"type":"integer","minimum":0},"tax_cents":{"type":"integer","minimum":0},"tax_treatment":{"type":"string"},"currency":{"type":"string","enum":["AUD"]},"due_today_cents":{"type":"integer","minimum":0},"payment_choice":{"type":"string","enum":["full","instalments"]},"schedule":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"integer","exclusiveMinimum":0},"due_date":{"type":"string","format":"date"},"amount_cents":{"type":"integer","exclusiveMinimum":0}},"required":["sequence","due_date","amount_cents"]}},"conditional_on_membership":{"type":"boolean"},"activation_mode":{"type":"string","enum":["immediate","approval_required"]}},"required":["product_id","name","product_kind","quote_version","term_start","end_date","renewal_boundary","annual_reference_price_cents","contracted_total_cents","subtotal_cents","tax_cents","tax_treatment","currency","due_today_cents","payment_choice","schedule","conditional_on_membership","activation_mode"]}}},"required":["success","data"]}}}},"400":{"description":"Missing cart identity, unsupported legacy identity header, invalid paymentChoice, or repeated paymentChoice keys","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or invalid, expired or revoked user bearer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The caller is not an authorised contact in this account, is a guest, or lacks cart.items.manage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart":{"get":{"tags":["Cart"],"summary":"Retrieve the current cart session","description":"Includes discount_code and a freshly computed discount_quote for the stored code. An invalid code remains stored with applies=false and full pricing. Reads do not check or spend discount refusal budgets. Changing the guest email or cart contact clears the stored code and accepted quote; re-apply the code through the budgeted POST operation for the new buyer. If a quote cannot be checked, the cart is returned with applies=false, version=unavailable, a generic refusal_message and full-price totals. Retry the read before paying, or remove the code to review full pricing. Remove a genuinely non-applying stored code with DELETE /v1/cart/discount before paying.","security":[{"apiKey":["cart.items.browse"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"responses":{"200":{"description":"Current cart session retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CartSession"}},"required":["success","data"]}}}},"400":{"description":"Missing or invalid session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/checkout-options":{"get":{"tags":["Cart"],"summary":"Retrieve checkout payment options for the current cart","description":"Evaluates the current buyer and cart against the organisation invoice policy. Invoice checkout remains unavailable for guests, disabled policies, unapproved buyers and unsupported product types. When invoice checkout is available, approvedCompanyIds contains only the account-scoped company ids the caller is authorised to select; member-only approval returns an empty array. The invoice option includes dueAt, dueLocalDate, timezone, ticketCutoffAt and ticketCutoffShortened before acceptance. Ticket capacity, closed reservation windows and unavailable events return an unavailable invoice option with a specific reason; online checkout is unchanged.","security":[{"apiKey":["cart.items.browse"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"responses":{"200":{"description":"Checkout options evaluated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CheckoutOptionsResponse"}},"required":["success","data"]}}}},"400":{"description":"Missing or invalid cart session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/items":{"post":{"tags":["Cart"],"summary":"Add an item to the cart","description":"Optionally accepts a per-seat `attendees` array (SPEC-CORE-20260721-event-attendee-capture). `attendees.length` must be <= `quantity`; custom_fields on each attendee is validated against the ticket's event attendee-field definitions before the item is added.","security":[{"apiKey":["cart.items.manage"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"productType":{"type":"string","minLength":1,"description":"Type of product to add. One of: event_tickets, courses, crm_membership_tiers, digital_products, crm_subscription_products, extra_seats. For extra_seats the productId is the corporate membership gaining the seats, which the signed-in buyer must hold or hold an admin seat on. Kept as a string rather than an enum so a new product type is an additive change; the registry is authoritative.","example":"digital_products"},"productId":{"type":"string","format":"uuid","description":"Product ID"},"addOnPurchase":{"type":"object","properties":{"paymentChoice":{"type":"string","enum":["full","instalments"]},"quoteVersion":{"type":"string","minLength":1},"recurringCardConsent":{"type":"boolean","default":false}},"required":["paymentChoice","quoteVersion"],"additionalProperties":false,"description":"An add-on payment choice and accepted quote version from GET /v1/cart/add-ons. Monthly instalments require explicit recurringCardConsent. The server derives all amounts, dates, membership identity and consent timestamp."},"quantity":{"type":"integer","minimum":1,"maximum":100,"description":"Quantity to add (1-100)"},"attendees":{"type":"array","items":{"$ref":"#/components/schemas/CartItemAttendeeInput"},"maxItems":100,"description":"One entry per seat, up to `quantity`. Optional — attendees can be named later via POST /v1/cart/items/attendees."}},"required":["productType","productId","quantity"]}}}},"responses":{"201":{"description":"Item added to cart successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AddItemResponse"}},"required":["success","data"]}}}},"400":{"description":"Validation error, invalid product, or attendee custom_fields failing the event attendee-field definitions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"A named attendee already holds a non-cancelled registration for the ticket, or is listed more than once on the line (error code `DUPLICATE_ATTENDEE`). The message names the attendee and the event.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/items/attendees":{"post":{"tags":["Cart"],"summary":"Set the attendees for an existing cart line","description":"Replaces `metadata.attendees` for the given cart item (SPEC-CORE-20260721-event-attendee-capture US-2.2) — the supplied array is the full, authoritative set for the line. `attendees.length` must be <= the item's quantity; custom_fields on each attendee is validated against the ticket's event attendee-field definitions. Guest carts (X-Cart-Session, no bearer) may call this route.","security":[{"apiKey":["cart.items.manage"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"itemId":{"type":"string","format":"uuid","description":"Cart item ID"},"attendees":{"type":"array","items":{"$ref":"#/components/schemas/CartItemAttendeeInput"},"maxItems":100,"description":"The full, authoritative attendees array for this line."}},"required":["itemId","attendees"]}}}},"responses":{"200":{"description":"Updated cart item. `meta.totals` carries the recomputed cart totals (currency, newTotalAmount, newTotalCount).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CartItem"}},"required":["success","data"]}}}},"400":{"description":"Validation error, attendees exceeding quantity, or attendee custom_fields failing the event attendee-field definitions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/items/update":{"post":{"tags":["Cart"],"summary":"Update the quantity of an item in the cart","security":[{"apiKey":["cart.items.manage"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"itemId":{"type":"string","format":"uuid","description":"Cart item ID"},"quantity":{"type":"integer","minimum":1,"maximum":100,"description":"New quantity (1-100)"}},"required":["itemId","quantity"]}}}},"responses":{"200":{"description":"Updated cart item. `meta.totals` carries the recomputed cart totals (currency, newTotalAmount, newTotalCount).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CartItem"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/items/remove":{"post":{"tags":["Cart"],"summary":"Remove an item from the cart","security":[{"apiKey":["cart.items.manage"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"itemId":{"type":"string","format":"uuid","description":"Cart item ID"}},"required":["itemId"]}}}},"responses":{"200":{"description":"Item removed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/RemoveItemResponse"}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/transfer":{"post":{"tags":["Cart"],"summary":"Transfer a guest cart to the authenticated user","description":"Changing the buyer removes any stored discount code and accepted discount quote. GET /v1/cart returns discount_code_cleared_reason = buyer_changed when a stored code was removed; the buyer can apply it again.","security":[{"apiKey":["cart.sessions.transfer"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for API-key callers acting on behalf of a logged-in user. Ignored in session mode."},"required":false,"name":"Authorization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"guestSessionToken":{"type":"string","minLength":1,"description":"Guest session token"}},"required":["guestSessionToken"]}}}},"responses":{"200":{"description":"Cart transferred successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/TransferResponse"}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/delete":{"post":{"tags":["Cart"],"summary":"Delete the current cart session","security":[{"apiKey":["cart.sessions.delete"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"Cart deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DeleteResponse"}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Cart not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/checkout/cancel":{"post":{"tags":["Cart"],"summary":"Cancel an in-progress checkout session","description":"Returns the cart to a mutable CURRENT state so the user can modify items and re-initiate checkout. The cart must be in LOCKED state. Cancelling also voids the pending hosted payment sessions (best-effort at the gateway, authoritatively in the session ledger), so a superseded payment page can no longer be paid or fulfilled.","security":[{"apiKey":["cart.checkout.manage"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"responses":{"200":{"description":"Checkout cancelled successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CancelCheckoutResponse"}},"required":["success","data"]}}}},"400":{"description":"Missing or invalid session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Cart not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Cart does not have an active checkout (not in LOCKED state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/checkout/complete":{"post":{"tags":["Cart"],"summary":"Finalise one settlement group after a successful payment","description":"Finalises ONE settlement group of a checked-out cart. A cart splits into one checkout session per settlement rail; `externalId` names the group's session. Resolves that session, confirms the group's payment with the provider against the group's own subtotal (never the whole cart total), then runs fulfilment for that group only: inserts a `crm_orders` row plus matching `crm_order_items` for the group's lines, dispatches the per-line fulfilment handlers, emits `crm.order.paid`, and removes the group's items. Zero-total groups are already fulfilled during checkout initiation: this operation verifies cart ownership and returns the existing paid zero-value order without contacting a payment provider. A free externalId alone is never payment proof. A cart emptied by a free group is kept with status `complete` so its receipt stays retrievable; a cart emptied by a paid group is deleted, and one with unpaid groups left returns to `current`. On fulfilment failure the group's session claim is released so the user can retry.","security":[{"apiKey":["cart.checkout.manage"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"description":"The externalId returned by checkout initiation: a provider session / payment-intent id, or free:<sessionId> for an already fulfilled zero-total group. Forwarded into `crm.order.paid` payloads."}},"required":["externalId"]}}}},"responses":{"200":{"description":"Group fulfilment complete. Add-on purchases return the canonical payment_receipt_id and each item's actual term invoice, obligation, receipt allocation, activation status and holding dates. order_id remains an actual invoice order identifier.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CompleteCheckoutResponse"}},"required":["success","data"]}}}},"400":{"description":"Missing identity, missing externalId, empty group, or unsupported product type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"402":{"description":"Payment not confirmed for this group's session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No checkout session or owning cart for this caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The group session is already being fulfilled (concurrent or duplicate delivery)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Fulfilment failed; the group's session claim released","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/checkout/simulate-success":{"post":{"tags":["Cart"],"summary":"Simulate a successful group checkout (dev only)","description":"Drives the cart fulfilment pipeline for ONE settlement group end-to-end without a real payment provider. `externalId` names the group's checkout session. Only enabled when `NODE_ENV != production` AND `CHECKOUT_PROVIDER=test`; in any other environment the route responds 404. Used by QA and the wdaa-connect dev-only `?simulate=success` flow to exercise the full cart -> `crm_orders` -> webhook pipeline.","security":[{"apiKey":["cart.checkout.simulate"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"description":"The externalId returned by `POST /v1/cart/checkout` against the test provider — one per settlement group. Used to locate the group's checkout session."}},"required":["externalId"]}}}},"responses":{"201":{"description":"Group fulfilment complete; the group's order is issued and its items removed (cart returned to `current` when unpaid groups remain, deleted when emptied)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SimulateSuccessResponse"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No checkout session matches the supplied externalId for this account, or the route is disabled in this environment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Fulfilment failed; the group's session claim released","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/checkout/invoice":{"post":{"tags":["Cart"],"summary":"Accept the active cart as an invoice order","description":"Atomically revalidates the active cart and buyer authority, snapshots the accepted order and invoice terms, and queues invoice delivery and line release. Unknown or active hosted-payment attempts block acceptance. Requires an authenticated buyer and the `cart.checkout.create` scope. Honours the stored cart code using the accepted discount quote's discount, line allocations and GST. Apply a code through POST /v1/cart/discount first; optional discount_code or discountCode must match the stored code. Send acceptedQuoteVersion from Review to refuse a stale quote. The use is consumed once at order creation; replay consumes no further use. Cancelling before payment releases the use; after payment it stands. Accepted invoice pricing is immutable and later payment preserves it.","security":[{"apiKey":["cart.checkout.create"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"paymentMethod":{"type":"string","enum":["invoice"]},"discount_code":{"type":"string","minLength":1,"maxLength":100},"discountCode":{"type":"string","minLength":1,"maxLength":100},"acceptedQuoteVersion":{"type":"string","minLength":1,"maxLength":128},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200},"companyId":{"type":["string","null"],"format":"uuid"},"purchaseOrderNumber":{"type":["string","null"],"minLength":1,"maxLength":100}},"required":["paymentMethod","idempotencyKey"]}}}},"responses":{"200":{"description":"Invoice order accepted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/InvoiceAcceptanceResponse"}},"required":["success","data"]}}}},"400":{"description":"Validation, cart, product, tax, discount-code, or purchase-order error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Buyer is not eligible or approved for invoice checkout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Cart revision conflict, another collection attempt is active, or a named ticket attendee already holds the ticket or is listed more than once (error code `DUPLICATE_ATTENDEE`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/invoices/{orderId}":{"get":{"tags":["Cart"],"summary":"Retrieve the current buyer invoice and release progress","description":"Returns the caller-owned invoice balance, receipts, reconciliation state and per-line release and ticket reservation state, including reservedUntil. Reserved places are not admission credentials. Another buyer or tenant receives no invoice data.","security":[{"apiKey":["cart.items.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"orderId","in":"path"},{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"responses":{"200":{"description":"Invoice progress retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/InvoiceOrderResponse"}},"required":["success","data"]}}}},"400":{"description":"Invalid order identifier or cart identity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated buyer identity required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Invoice not found for the current buyer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cart/checkout":{"post":{"tags":["Cart"],"summary":"Initiate a checkout session","description":"When discount_code is omitted, checkout applies the stored cart code. A stored code that no longer applies is refused through the budgeted path; DELETE /v1/cart/discount before paying at full price. A submitted discount_code is budget-checked and evaluated before any accepted_quote_version comparison. Locks the cart and creates one checkout session per settlement group. A cart splits into one session per settlement rail: own-catalogue lines and course lines (rail `marketplace`) both settle to the cart organisation with no platform fee. The response `groups` array carries one session (with its own `checkoutUrl` and `externalId`) per group. A group with subtotalCents of 0 skips the payment provider and is fulfilled immediately; its externalId is free:<sessionId> and checkoutUrl is the success URL with session_id set to that externalId. Its zero-value order is not posted to the accounting provider. Paid groups use the settling account's configured payment gateway (Stripe Connect or eWay) and expire after 30 minutes; mixed free and paid lines are charged only for the paid total. Requires the `cart.checkout.create` scope. In non-production environments a test or no-op provider may be substituted via `CHECKOUT_PROVIDER`.","security":[{"apiKey":["cart.checkout.create"]}],"parameters":[{"schema":{"type":"string","description":"Bearer <supabase-jwt>. Required for logged-in callers in API-key mode. The middleware validates the JWT and resolves the user to a CRM contact within the calling account. Mutually exclusive with X-Cart-Session."},"required":false,"name":"Authorization","in":"header"},{"schema":{"type":"string","description":"Guest cart session token returned from POST /v1/cart/items when no Authorization bearer is supplied. Required for anonymous cart flows in API-key mode."},"required":false,"name":"X-Cart-Session","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"successUrl":{"type":"string","format":"uri","description":"Success redirect URL"},"cancelUrl":{"type":"string","format":"uri","description":"Cancel redirect URL"},"discount_code":{"type":"string","minLength":1,"maxLength":100,"description":"Optional discount code, trimmed to 1 to 100 characters and matched without regard to case. Validated and reserved when checkout starts, and consumed only when the order is paid. The discount is reflected in each group's subtotalCents. A refused code returns HTTP 400 with error code INVALID_DISCOUNT_CODE and a message safe to show the buyer. Unknown and not-yet-valid codes return \"This discount code is not valid.\" Expired codes return \"This discount code has expired.\" Exhausted codes return \"This discount code has been fully used.\" A signed-in buyer at their per-buyer limit receives \"You've already used this discount code, or have a checkout in progress with it.\"; guests receive the generic message. Cart value and cart product-type eligibility are checked before code lookup; minimum-order refusals precede per-buyer checks. Codes apply to carts whose lines are all event tickets or all courses. A code whose applicable_course_ids contains every course in a course-only cart applies at Review and at checkout. A course outside that scope, or a course cart using a code with neither course nor membership scope, returns \"This discount code is not valid.\", identically to an unknown code. Foreign-organisation and integration-owned codes return \"This discount code is not valid.\" The minimum order value is measured against the eligible lines’ gross. Member course pricing applies before the discount. Mixed carts remain ineligible. Discount checkout uses shared Postgres refusal budgets: 5 per cart and 20 per signed-in user (user:id) within 10 minutes. On /v1, an unauthenticated guest has only the per-cart (5) and per-key (200) budgets; no caller budget applies. The API-key backstop is 200 refusals per 10 minutes and is shared by every buyer using that key. Once limited, every code returns HTTP 429 RATE_LIMITED with \"Too many discount code attempts. Try again in a few minutes.\" and a Retry-After header computed from the remaining window, before revalidation or checkout-attempt creation. Successful codes do not spend the refusal budget. Concurrent submissions already in flight may complete."},"accepted_quote_version":{"type":"string","minLength":1,"maxLength":128,"description":"Version of the server discount quote accepted at Review. A changed quote returns 409 CART_CONFLICT before a payment session is created."},"guest_buyer":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","maxLength":254,"format":"email"}},"required":["name","email"],"description":"Buyer name (1 to 200 characters) and email. Required for every checkout where no bearer token identifies the buyer (a guest cart); ignored when a bearer token does. The email identifies the buyer of record for the order: an existing contact with that email or a new contact. The per-buyer discount limit is applied to this email. Changing the normalised buyer email removes any stored discount code and accepted discount quote. Read the cart and apply the code again for the new buyer."}},"required":["successUrl","cancelUrl"]}}}},"responses":{"200":{"description":"Checkout session created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CheckoutResponse"}},"required":["success","data"]}}}},"400":{"description":"Validation error (VALIDATION_ERROR), including a missing guest_buyer on a guest checkout, camelCase discountCode or guestBuyer fields, or an unparseable request body; empty cart or refused discount code (INVALID_DISCOUNT_CODE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The organisation is a sandbox whose primary payment gateway is not an active Stripe sandbox or eWay sandbox gateway, so a paid checkout is refused with error code `SANDBOX_PAYMENT_NOT_PERMITTED`. Free carts are unaffected.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Conflict or invalid cart state, including a named ticket attendee who already holds the ticket or is listed more than once (error code `DUPLICATE_ATTENDEE`). Checked before any payment session is created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Discount code refusal budget exhausted (RATE_LIMITED), identical for every submitted code, or the gateway request budget exhausted (RATE_LIMIT_EXCEEDED).","headers":{"Retry-After":{"description":"Seconds until the applicable window resets: the discount refusal budget for RATE_LIMITED, or the gateway request budget for RATE_LIMIT_EXCEEDED.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string","enum":["RATE_LIMITED"]},"message":{"type":"string","enum":["Too many discount code attempts. Try again in a few minutes."]}},"required":["code","message"]}},"required":["success","error"]},{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string","enum":["RATE_LIMIT_EXCEEDED"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}]}}}},"502":{"description":"Provider error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cms/content":{"get":{"tags":["CMS"],"summary":"List published CMS content for a collection","description":"Returns published content items for the named collection. Filters by category-slug, tag-slug, language, and free-text search. Each content item includes its canonical subject topics. The `categories` response field is a deprecated alias of `topics` and has a Sunset date of 2027-03-05. Paginated and sortable. Account-scoped: items from the API key's account plus globally-shared items (account_id IS NULL) are included. Requires `cms.content.browse` scope.\n\nList responses never carry a body: no `content`, no `fragments`, and no protected fragment payload, only the safe teaser fields plus the `access` envelope.\n\nOptional member identity (SPEC-CMS-20260727 US-2.3): supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key and the response is projected for that member. Without a bearer the anonymous projection is served. A bearer that is present but invalid is REJECTED (401) rather than downgraded to anonymous. Every record carries an `access` envelope naming the policy `mode` and the caller's `state`. Responses evaluated with an identity are returned `Cache-Control: private, no-store` and must not be stored in a shared cache.","security":[{"apiKey":["cms.content.browse"]},{"apiKey":["cms.content.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":100},"required":true,"name":"collection","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":120},"required":false,"name":"category","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":120},"required":false,"name":"tag","in":"query"},{"schema":{"type":"string","maxLength":10},"required":false,"name":"language","in":"query"},{"schema":{"type":"string","enum":["published_at","title","order_position"]},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"]},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string"},"required":false,"name":"authorization","in":"header"}],"responses":{"200":{"description":"Paginated content items","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsContentListResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["CMS"],"summary":"Ingest a content revision from a source connector","description":"Upserts one content revision authored in an external system, together with its access policy and ordered fragments. Requires both `cms.content.create` and `cms.content.update`: the route is an upsert and the caller cannot know in advance which it will perform.\n\nServer-to-server only. The connector holds an API key; no member bearer is involved, unlike the read routes.\n\nIdempotent on `source.id` plus `source.revision`. Replaying a revision already held returns `outcome: \"unchanged\"` and writes nothing, so a retry after a timeout is safe.\n\nEvery validation failure aborts the WHOLE revision and leaves the previously published record untouched. There is no partial import: a partially imported restricted document is a published record whose policy did not survive the trip. Rejected cases include an unreadable `access_policy`, an unreadable fragment policy, a policy naming a membership tier belonging to another account, and an absent policy on an account that has member content access enabled.","security":[{"apiKey":["cms.content.create","cms.content.update"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsSyncContent"}}}},"responses":{"200":{"description":"Revision already held, or an existing record updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsSyncResponse"}}}},"201":{"description":"A new record was created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsSyncCreatedResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cms/content/{slug}":{"get":{"tags":["CMS"],"summary":"Get a published content item by slug","description":"Returns the published content item matching the slug in the API key's account (or the globally-shared content set, where account_id is NULL). Pass `collection` if multiple collections share a slug namespace. Requires `cms.content.browse` scope.\n\nA record the caller cannot read returns HTTP 200 with the safe teaser fields, `content: null`, `fragments: null` and the `access` envelope: the response SHAPE, not an HTTP error, is what distinguishes a restricted projection. For a mixed document, readable regions are returned in order and each redacted region is replaced by an `access-gate` placeholder. A restricted block inside a `block.container` or `block.row` slot is replaced the same way by a nested `access-gate` entry (`CmsNestedAccessGate`: `id`, `type`, `access`, with no `position` and no `payload`); adjacent nested gates with the same requirement collapse into one, and a restricted container is returned as one top-level gate with nothing beneath it.\n\nA block hidden by its display conditions (a personalisation setting, not an access policy) is omitted from `fragments`, at the top level or inside a slot, with no `access-gate` entry and nothing else in its place, so the caller is not told that anything was withheld. Position values count the blocks returned. A malformed condition, or one needing a viewer fact that could not be resolved, hides the block the same way.\n\nOptional member identity (SPEC-CMS-20260727 US-2.3): supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key and the response is projected for that member. Without a bearer the anonymous projection is served. A bearer that is present but invalid is REJECTED (401) rather than downgraded to anonymous. Every record carries an `access` envelope naming the policy `mode` and the caller's `state`. Responses evaluated with an identity are returned `Cache-Control: private, no-store` and must not be stored in a shared cache.","security":[{"apiKey":["cms.content.browse"]},{"apiKey":["cms.content.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":100},"required":false,"name":"collection","in":"query"},{"schema":{"type":"string","maxLength":10},"required":false,"name":"language","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string"},"required":false,"name":"authorization","in":"header"}],"responses":{"200":{"description":"Content item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsContentResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Content not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cms/digital-products":{"get":{"tags":["CMS"],"summary":"List active CMS-managed digital products","description":"Returns the tenant digital-product catalogue with server-authoritative AUD pricing and a caller-specific purchase state. A member bearer is optional; when present, current membership pricing and existing ownership are evaluated and the response is private/no-store. Internal entitlement keys and protected asset metadata are never returned by this public catalogue.","security":[{"apiKey":["cms.content.browse"]},{"apiKey":["cms.content.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string"},"required":false,"name":"authorization","in":"header"}],"responses":{"200":{"description":"Paginated digital product catalogue","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsDigitalProductListResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cms/digital-products/owned":{"get":{"tags":["CMS"],"summary":"List digital products owned by the signed-in contact","description":"Returns products currently held through an effective entitlement, plus opaque protected-asset ids and display metadata. A member bearer is mandatory. Signed URLs are never included; clients obtain one only when the user clicks an asset and calls the protected asset endpoint.","security":[{"apiKey":["cms.content.browse","cms.assets.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string"},"required":true,"name":"authorization","in":"header"}],"responses":{"200":{"description":"Paginated owned digital products","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnedCmsDigitalProductListResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cms/digital-products/{slug}":{"get":{"tags":["CMS"],"summary":"Get one active digital product by content slug","description":"Returns safe presentation fields, authoritative pricing, and the caller-specific purchase state for one tenant product. Entitlement identity and protected files are omitted.","security":[{"apiKey":["cms.content.browse"]},{"apiKey":["cms.content.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string"},"required":false,"name":"authorization","in":"header"}],"responses":{"200":{"description":"Digital product detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsDigitalProductResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Digital product not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cms/assets/{id}":{"get":{"tags":["CMS"],"summary":"Authorise and mint a short-lived protected download URL","description":"Returns a short-lived signed URL for a protected asset, after re-checking that the caller may have it.\n\nAuthorisation is RECOMPUTED on every call, from the bearer member's current tier set and the policy governing the fragment the asset belongs to. No decision made when the CMS page was rendered is trusted, so a stale page cannot authorise a download and an asset id copied out of page source is not a durable key.\n\nA member bearer is REQUIRED. There is no anonymous protected download.\n\nEvery refusal returns the same 404, whether the asset does not exist, belongs to another tenant, is not governed by any published fragment, or is governed by a policy the caller does not satisfy. The endpoint therefore cannot be used to enumerate asset ids or probe another tenant's library.\n\nThe response is never cacheable. The URL it carries is minted for one caller and expires shortly after issue.","security":[{"apiKey":["cms.assets.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string"},"required":true,"name":"authorization","in":"header"}],"responses":{"200":{"description":"A short-lived signed download URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsAssetDownloadResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/cms/assets":{"post":{"tags":["CMS"],"summary":"Upload a protected asset server-to-server","description":"Stores a file in private, tenant-scoped storage and returns its opaque id. Requires `cms.assets.create`.\n\nServer-to-server only, as `multipart/form-data` with a `file` part. The browser never uploads to Agend storage and no upload URL is issued. The bucket has no policy admitting a browser client, so this route is the only writer.\n\nThe response carries the asset id and display metadata only. No storage path, bucket name, or provider URL is returned, because the consuming CMS must not be able to store one: the id is meaningless without the authorising download endpoint, which is what makes it safe to embed in a page.","security":[{"apiKey":["cms.assets.create"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"required":["file"]}}}},"responses":{"201":{"description":"The asset was stored and registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsAssetRegisteredResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/listings":{"get":{"tags":["Directory"],"summary":"List business listings for the authenticated account","description":"Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key (SPEC-DIR-20260730-directory-member-field-access US-3.1; SPEC-DIR-20260902-directory-api-parity US-2.1): an invalid or expired bearer is rejected (401); an absent bearer serves the anonymous response unchanged. Each listing carries its canonical subject topics and a `custom_fields` entry per the account's active `display_on_detail` definitions, gated identically to `GET /v1/directory/listings/{slugOrId}`: a field the caller is not entitled to see resolves to a gate placeholder (`{ key, label, mode, state, gated: true }`) instead of a value, and the response carries `Cache-Control: private, no-store` once a bearer has been validated. `status` defaults to `approved`; any other value (`pending`, `rejected`, `suspended`) is an administrative bulk read and additionally requires the `directory.listings.manage` scope (403 without it).","security":[{"apiKey":["directory.listings.browse"]},{"apiKey":["directory.listings.browse"],"userBearer":[]},{"apiKey":["directory.listings.browse","directory.listings.manage"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (1-based)"},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Results per page (1–100). Legacy alias `per_page` is accepted on listings/search and will be removed in v2."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["pending","approved","rejected","suspended"],"description":"Filter by listing status. Defaults to `approved`. Any other value requires the directory.listings.manage scope; 403 without it."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","description":"Full-text search query"},"required":false,"name":"search","in":"query"},{"schema":{"type":["boolean","null"],"description":"Filter by featured flag"},"required":false,"name":"featured","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Resolve the approved listing(s) linked to this Loop/auth user via member_listings. Each result additionally carries `dms_open` and `loop_user_id`."},"required":false,"name":"user_id","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of cities to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial: city=newcastle matches a stored Newcastle but not Newcastle West. Cannot be combined with suburb."},"required":false,"name":"city","in":"query"},{"schema":{"type":"string","description":"Alias for city (Australian addressing). Comma-separated, case-insensitive exact matching, same rules as city. Cannot be combined with city in the same request (422 naming both)."},"required":false,"name":"suburb","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of states to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial."},"required":false,"name":"state","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of postcodes to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial."},"required":false,"name":"postcode","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of countries to match; values within the list are ORed. Matching is case-insensitive exact against the value as stored, with no normalisation. Discover an account's real values with GET /v1/directory/facets?fields=location.country."},"required":false,"name":"country","in":"query"}],"responses":{"200":{"description":"Paginated list of business listings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DirectoryListingList"}}}},"401":{"description":"Unauthorized — missing/invalid API key, or an invalid/expired member bearer token when one was supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"A named location filter with more than 50 values for one component, a value over 100 characters, city and suburb supplied together, or named location filters exceeding 8 entries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Directory"],"summary":"Create a new business listing","description":"An `item_list` custom-field value is an array of at most 1000 objects, each keyed only by that field's declared item field keys. A `number` item field accepts a numeric string: a plain decimal numeral within safe precision, such as `\"250\"`, is stored as a number, and any other numeric string is stored as sent. An item missing a declared key is valid. A value that is not an array, an item that is not an object, an item holding an undeclared key, an invalid `number` value, or more than 1000 items refuses the request with 400 `VALIDATION_ERROR`, and a refusal writes nothing. `error.details.fields` is keyed by `custom_fields.<field_key>`, `custom_fields.<field_key>.<index>` or `custom_fields.<field_key>.<index>.<key>`, each holding the messages for that path. Only active `item_list` fields are validated. The check reads the account's field definitions, so if they cannot be read the value is stored as received. An id in `category_ids` or `tag_ids` that names no category or tag of the calling organisation, whether it does not exist or belongs to another organisation, refuses the request with 400 `VALIDATION_ERROR` and `error.details.fields.category_ids` or `error.details.fields.tag_ids`, and a refusal writes nothing. An id in `badge_ids` that names an inactive listing badge is ignored: it adds no link, and the write succeeds. An id that names no listing badge of the calling organisation, whether it does not exist or belongs to another organisation, refuses the request with 400 `VALIDATION_ERROR` and `error.details.fields.badge_ids`, and a refusal writes nothing.","security":[{"apiKey":["directory.listings.manage"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":"string","maxLength":10000},"short_description":{"type":"string","maxLength":500},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]}]},"phone":{"type":"string","maxLength":50},"website":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"address_line_1":{"type":"string","maxLength":255},"address_line_2":{"type":"string","maxLength":255},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postcode":{"type":"string","maxLength":20},"country":{"type":"string","maxLength":100,"default":"AU"},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"business_hours":{"type":["object","null"],"additionalProperties":{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"},"closed":{"type":"boolean"}}}},"facebook_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"instagram_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"twitter_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"linkedin_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"youtube_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"logo_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]}]},"hero_image_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]}]},"gallery_images":{"type":"array","items":{"type":"string","format":"uri"}},"meta_title":{"type":"string","maxLength":255},"meta_description":{"type":"string","maxLength":500},"meta_keywords":{"type":["array","null"],"items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"tag_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"badge_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"custom_fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["pending","approved","rejected","suspended"]},"publish":{"type":"boolean"},"locations":{"type":"array","items":{"type":"object","properties":{"name":{"type":["string","null"],"maxLength":100},"address_line_1":{"type":["string","null"],"maxLength":255},"address_line_2":{"type":["string","null"],"maxLength":255},"city":{"type":["string","null"],"maxLength":100},"state":{"type":["string","null"],"maxLength":100},"postcode":{"type":["string","null"],"maxLength":20},"country":{"type":["string","null"],"maxLength":100},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"phone":{"type":["string","null"],"maxLength":50},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]},{"type":"null"}]},"hours":{"type":["object","null"],"additionalProperties":{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"},"closed":{"type":"boolean"}}}},"is_primary":{"type":"boolean"}}}}},"required":["name"]}}}},"responses":{"201":{"description":"Listing created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/BusinessListing"}},"required":["success","data"]}}}},"400":{"description":"Invalid request body, or an invalid `item_list` custom-field value (`VALIDATION_ERROR`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/listings/{slugOrId}":{"get":{"tags":["Directory"],"summary":"Get a business listing by slug or ID","description":"Resolves a slug first, then a UUID. Returns the public detail shape; email and internal columns are never included, and `accepts_enquiries` and `enquiry_terms_url` say whether and on what terms `POST /v1/directory/listings/{slugOrId}/enquiries` can reach the listing. Only publicly-visible listings are returned — approved, published (`published_at` in the past), not expired, and not deleted — the same rule `GET /v1/directory/search` applies; anything else responds 404 so listing existence is not disclosed. Pass `includeUnpublished=true` to read a listing in any state (pending, rejected, suspended, unpublished, expired): that is an administrative read and additionally requires the `directory.listings.manage` scope (403 without it). Pass `include=achievements` to add the member LMS \"Badges & Credentials\" set: it additionally requires the `directory.achievements.browse` scope (403 without it) and is only returned for members who have opted to show them. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key (SPEC-DIR-20260730-directory-member-field-access US-3.1): each `custom_fields` entry the caller is not entitled to resolves to a gate placeholder (`{ key, label, mode, state, gated: true }`, never a value, tier id, or tier/segment name) instead of the resolved value, and the response carries `Cache-Control: private, no-store` once a bearer has been validated (regardless of grant outcome). An invalid or expired bearer is rejected (401), never silently downgraded to anonymous. An absent bearer is unaffected — the anonymous response and its cache headers are unchanged. `custom_fields` is returned in `sort_order` ascending then `created_at` ascending — the flat sequence an administrator set for the `listing` entity, contiguous and unambiguous after any reorder (SPEC-CORE-20260728-custom-field-ordering) — and a gate placeholder holds its position in that sequence rather than being filtered out, so rendering order does not change with what a caller is entitled to see. `phone` and every `locations[].phone` are null when the organisation hides phone in its directory form settings. `phone` is also null when an active field group naming `business_listings.phone` does not grant the viewer, and every `locations[].phone` when one naming `listing_locations.phone` does not; a key named by several groups is shown only when every one of them grants it, and an entitlement grants it only when the entitlement is scoped to include this listing. A member bearer token whose standing satisfies those groups receives the phone. This applies to every caller, a `directory.listings.manage` key included, and both phones remain a string or null. `badges` omits every inactive listing badge, for every caller, `includeUnpublished=true` included; the listing keeps its link to an inactive listing badge, which shows again once it is reactivated. Listing location coordinates may come from Amazon Location Service. A client displaying them, on a map or otherwise, shows the credit \"Locations: Amazon Location Service\" linked to the AWS data attribution page, https://docs.aws.amazon.com/location/latest/developerguide/data-attribution.html.","security":[{"apiKey":["directory.listings.browse"]},{"apiKey":["directory.listings.browse","directory.achievements.browse"]},{"apiKey":["directory.listings.browse","directory.listings.manage"]},{"apiKey":["directory.listings.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","description":"Listing slug or UUID"},"required":true,"name":"slugOrId","in":"path"},{"schema":{"type":"string","description":"Comma-separated optional sections to include. Supported: `achievements` (requires the directory.achievements.browse scope)."},"required":false,"name":"include","in":"query"},{"schema":{"type":"string","enum":["true","false"],"description":"Set to `true` to read a listing in any publication state. Requires the directory.listings.manage scope; 403 without it. Omitted or `false` returns publicly-visible listings only."},"required":false,"name":"includeUnpublished","in":"query"}],"responses":{"200":{"description":"Business listing details","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DirectoryListingDetail"}},"required":["success","data"]}}}},"401":{"description":"Unauthorized — missing/invalid API key, or an invalid/expired member bearer token when one was supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Listing not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"tags":["Directory"],"summary":"Update a business listing","description":"An `item_list` custom-field value is an array of at most 1000 objects, each keyed only by that field's declared item field keys. A `number` item field accepts a numeric string: a plain decimal numeral within safe precision, such as `\"250\"`, is stored as a number, and any other numeric string is stored as sent. An item missing a declared key is valid. A value that is not an array, an item that is not an object, an item holding an undeclared key, an invalid `number` value, or more than 1000 items refuses the request with 400 `VALIDATION_ERROR`, and a refusal writes nothing. `error.details.fields` is keyed by `custom_fields.<field_key>`, `custom_fields.<field_key>.<index>` or `custom_fields.<field_key>.<index>.<key>`, each holding the messages for that path. Only active `item_list` fields are validated. The check reads the account's field definitions, so if they cannot be read the value is stored as received. A `category_ids` or `tag_ids` array replaces the listing's links of that kind. An id that names no category or tag of the calling organisation, whether it does not exist or belongs to another organisation, refuses the request with 400 `VALIDATION_ERROR` and `error.details.fields.category_ids` or `error.details.fields.tag_ids`, and a refusal writes nothing, unless the listing is already linked to it: such an id adds no link, and the existing link is removed. A `badge_ids` array replaces only the listing's links to active listing badges. A link to an inactive listing badge is kept whether or not `badge_ids` names it, and an id naming an inactive listing badge adds no link, so while a listing badge is inactive its links can be neither added nor removed, and the write succeeds. Reactivating the listing badge restores it on every listing still linked to it. An id that names no listing badge of the calling organisation, whether it does not exist or belongs to another organisation, refuses the request with 400 `VALIDATION_ERROR` and `error.details.fields.badge_ids`, and a refusal writes nothing, unless the listing is already linked to it: such an id adds no link, and the existing link is removed.","security":[{"apiKey":["directory.listings.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Listing UUID"},"required":true,"name":"slugOrId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":"string","maxLength":10000},"short_description":{"type":"string","maxLength":500},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]}]},"phone":{"type":"string","maxLength":50},"website":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"address_line_1":{"type":"string","maxLength":255},"address_line_2":{"type":"string","maxLength":255},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postcode":{"type":"string","maxLength":20},"country":{"type":"string","maxLength":100},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"business_hours":{"type":["object","null"],"additionalProperties":{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"},"closed":{"type":"boolean"}}}},"facebook_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"instagram_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"twitter_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"linkedin_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"youtube_url":{"anyOf":[{"type":"string","maxLength":1000,"format":"uri"},{"type":"string","enum":[""]}]},"logo_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]}]},"hero_image_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","enum":[""]}]},"gallery_images":{"type":"array","items":{"type":"string","format":"uri"}},"meta_title":{"type":"string","maxLength":255},"meta_description":{"type":"string","maxLength":500},"meta_keywords":{"type":["array","null"],"items":{"type":"string"}},"category_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"tag_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"badge_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"custom_fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["pending","approved","rejected","suspended"]},"locations":{"type":"array","items":{"type":"object","properties":{"name":{"type":["string","null"],"maxLength":100},"address_line_1":{"type":["string","null"],"maxLength":255},"address_line_2":{"type":["string","null"],"maxLength":255},"city":{"type":["string","null"],"maxLength":100},"state":{"type":["string","null"],"maxLength":100},"postcode":{"type":["string","null"],"maxLength":20},"country":{"type":["string","null"],"maxLength":100},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"phone":{"type":["string","null"],"maxLength":50},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]},{"type":"null"}]},"hours":{"type":["object","null"],"additionalProperties":{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"},"closed":{"type":"boolean"}}}},"is_primary":{"type":"boolean"}}}}}}}}},"responses":{"200":{"description":"Updated listing","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/BusinessListing"}},"required":["success","data"]}}}},"400":{"description":"Invalid request body, or an invalid `item_list` custom-field value (`VALIDATION_ERROR`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Listing not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Directory"],"summary":"Delete (soft-delete) a business listing","security":[{"apiKey":["directory.listings.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Listing UUID"},"required":true,"name":"slugOrId","in":"path"}],"responses":{"200":{"description":"Listing deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DirectoryListingDeleted"}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Listing not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/listings/bulk-upsert":{"post":{"tags":["Directory"],"summary":"Bulk-upsert business listings matched by external id","description":"Accepts up to 100 listings and matches each on `(external_source, external_id)` within the calling account. Existing rows are updated, new rows are inserted; deletes are not supported. Validation is two-tier: `external_source` and the batch size (`listings`) are envelope-level and a failure there is a 400; each listing is then validated independently, so a malformed row never rejects the batch. Always returns HTTP 200 once the envelope is valid; per-item results (including validation failures, each with `error.fields: [{ path, message }]` naming the offending field) live inside `data.results`. Each listing accepts `on_missing: 'create' | 'skip'` (default `'create'`): a `'skip'` row updates its matching listing when one exists, or is reported `results[].status: 'skipped'` and writes nothing when none does. `data.skipped` counts these rows, and `data.total` equals `data.succeeded + data.failed + data.skipped`. Requires the dedicated `directory.listings.bulk_upsert` scope (distinct from `directory.listings.manage` so least-privilege importer keys can be issued). A `select`/`radio`/`multi_select`/`checkbox_group` custom-field value is matched against the field's existing options first: an exact match on the stored `value`, or a case-insensitive match on the option `label`, always succeeds and stores that option's canonical `value` (never the raw input). A value matching neither is auto-created as a new option only when the key ALSO holds `directory.listings.manage` AND the field targets ONLY listings (a field shared with another entity type, e.g. contacts, never accepts a new option here, regardless of scope); each creation is reported as `{ code: \"OPTION_CREATED\", path, value, label }` in that row's `results[].notices`, where `value` is the stored canonical value and `label` is the input as sent. A new value whose derived value collides with an existing or just-created option is never merged into it: it receives its own numeric-suffixed value and becomes a second option. Without `directory.listings.manage`, on a shared field, once a field reaches 500 options, or for a value over 255 characters, an unmatched value fails the row with `error.code: \"VALIDATION_ERROR\"` and nothing is written for it (this replaced storing the raw value unchanged). A row that fails on any one custom field never causes a new option to be created for any of its OTHER custom fields either, so a row that is ultimately rejected leaves no orphaned option behind (a new option is still created when a different, passing row in the same batch independently needs the same value). An internal failure reading the account's custom-field definitions fails the whole batch with `INTERNAL_ERROR` (500) rather than skipping option validation for the request. An `item_list` custom-field value is an array of objects, each keyed only by that field's declared item field keys (a `number` item field accepts a numeric string; a plain decimal numeral within safe precision, such as `\"250\"`, is stored as a number, and any other numeric string is stored as sent); an item holding an undeclared key, a value that is not an array, an item that is not an object, an invalid `number` value, or more than 1000 items each fail that row with `error.code: \"VALIDATION_ERROR\"` and `error.fields[].path` naming `custom_fields.<field_key>`, `custom_fields.<field_key>.<index>`, or `custom_fields.<field_key>.<index>.<key>` as appropriate; an item missing a declared key is valid. When a row writes the single top-level address (no `locations`), a row that omits both `latitude` and `longitude` keeps the primary location's stored coordinates when every address field (`address_line_1`, `address_line_2`, `city`, `state`, `postcode`, `country`, where an omitted field is written as null) matches the stored value, ignoring surrounding whitespace and treating an empty value as absent, and clears them when any of those fields differs, so the location is geocoded again from its new address. A row that sends either coordinate, including an explicit null, writes both as sent, with an omitted one stored as null, so sending both as null clears them. A `badge_slugs` array on an updated row replaces only the listing's links to active listing badges: a link to an inactive listing badge is kept whether or not `badge_slugs` names it, and a slug naming an inactive listing badge adds no link, on an updated or a new row alike, and the row still succeeds. A slug resolves within the calling account, so no other organisation's listing badge is ever linked; a listing badge deleted while its row is written fails that row with `error.code: \"VALIDATION_ERROR\"` and `error.fields[].path` `badge_ids`. When the deletion is seen before the row is planned, the row's listing is not written; when it lands later, the listing may already be written and only its badge links fail.","security":[{"apiKey":["directory.listings.bulk_upsert"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"external_source":{"type":"string","minLength":1,"maxLength":64},"listings":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":255},"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":"string","maxLength":10000},"short_description":{"type":"string","maxLength":500},"email":{"type":"string","format":"email"},"phone":{"type":"string","maxLength":50},"website":{"type":"string","maxLength":1000,"format":"uri"},"hero_image_url":{"type":"string","maxLength":1000,"format":"uri"},"address_line_1":{"type":["string","null"],"maxLength":255},"address_line_2":{"type":["string","null"],"maxLength":255},"city":{"type":["string","null"],"maxLength":100},"state":{"type":["string","null"],"maxLength":100},"postcode":{"type":["string","null"],"maxLength":20},"country":{"type":["string","null"],"maxLength":100},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"business_hours":{"type":"object","additionalProperties":{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"},"closed":{"type":"boolean"}}}},"custom_fields":{"type":"object","additionalProperties":{}},"external_metadata":{"type":["object","null"],"properties":{}},"status":{"type":"string","enum":["pending","approved","rejected","suspended"]},"category_slugs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100},"maxItems":50},"tag_slugs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100},"maxItems":50},"badge_slugs":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100},"maxItems":50},"locations":{"type":"array","items":{"type":"object","properties":{"name":{"type":["string","null"],"maxLength":100},"address_line_1":{"type":["string","null"],"maxLength":255},"address_line_2":{"type":["string","null"],"maxLength":255},"city":{"type":["string","null"],"maxLength":100},"state":{"type":["string","null"],"maxLength":100},"postcode":{"type":["string","null"],"maxLength":20},"country":{"type":["string","null"],"maxLength":100},"latitude":{"type":["number","null"],"minimum":-90,"maximum":90},"longitude":{"type":["number","null"],"minimum":-180,"maximum":180},"phone":{"type":["string","null"],"maxLength":50},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]},{"type":"null"}]},"hours":{"type":["object","null"],"additionalProperties":{"type":"object","properties":{"open":{"type":"string"},"close":{"type":"string"},"closed":{"type":"boolean"}}}},"is_primary":{"type":"boolean"}}},"maxItems":50},"on_missing":{"type":"string","enum":["create","skip"],"default":"create"}},"required":["external_id","name"]},"minItems":1,"maxItems":100},"auto_publish_approved":{"type":"boolean","default":false}},"required":["external_source","listings"]}}}},"responses":{"200":{"description":"Bulk upsert completed (may contain per-item errors, including per-row validation failures reported with `error.fields`)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"succeeded":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"external_id":{"type":"string"},"status":{"type":"string","enum":["created","updated","skipped","error"]},"id":{"type":"string","format":"uuid"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]}}},"required":["code","message"]},"warnings":{"type":"array","items":{"type":"string"}},"notices":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["OPTION_CREATED"]},"path":{"type":"string"},"value":{"type":"string"},"label":{"type":"string"}},"required":["code","path","value","label"]}}},"required":["index","external_id","status"]}}},"required":["total","succeeded","failed","skipped","results"]}},"required":["success","data"]}}}},"400":{"description":"Invalid request envelope (missing `external_source`, or `listings` is not a 1-100 item array). Per-item field failures are never a 400 — see 200 above.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden — key lacks directory.listings.bulk_upsert","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/categories":{"get":{"tags":["Directory"],"summary":"List directory categories for the authenticated account","security":[{"apiKey":["directory.categories.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":500,"default":50,"description":"Maximum number of categories to return"},"required":false,"name":"limit","in":"query"},{"schema":{"type":["boolean","null"],"default":true,"description":"Attach `listing_count` to each category in the response: the number of publicly visible listings (approved, published, and neither deleted nor expired) linked directly to that category, excluding its subcategories"},"required":false,"name":"counts","in":"query"},{"schema":{"type":["boolean","null"],"default":false,"description":"Return only active categories"},"required":false,"name":"active_only","in":"query"}],"responses":{"200":{"description":"List of categories","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/search":{"get":{"tags":["Directory"],"summary":"Search directory listings (keyword mode)","description":"Returns a paginated, envelope-wrapped result. `meta.response_time_ms` and `meta.ai_enabled` are populated alongside the success envelope. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key (SPEC-DIR-20260730-directory-member-field-access US-3.1; SPEC-DIR-20260902-directory-api-parity US-2.2/US-2.3): an invalid or expired bearer is rejected (401); an absent bearer serves the anonymous response unchanged. A key-only request receives exactly the publicly visible `custom_fields` set and matches only against publicly visible values, byte-identical to the anonymous projection. A valid bearer additionally elevates both the `custom_fields` set on each card and which values a gated filter matches against, to the entitlement that token resolves to — never further, and never from anything other than the verified token. Each card carries every location in `locations`, and `selected_location_id` names the one a card presents when it shows a single location: for a search that includes a location, the nearest geocoded location, or the primary location when none is geocoded; otherwise the primary location. A listing with no primary location falls back to its earliest-created location. Each card lists only its active listing badges in `badges`: a deactivated listing badge is omitted from every card until it is reactivated. Listing location coordinates may come from Amazon Location Service. A client displaying them, on a map or otherwise, shows the credit \"Locations: Amazon Location Service\" linked to the AWS data attribution page, https://docs.aws.amazon.com/location/latest/developerguide/data-attribution.html.","security":[{"apiKey":["directory.listings.search"]},{"apiKey":["directory.listings.search"],"userBearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (1-based)"},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Results per page, 1 to 100 (default 20). A larger value is reduced to 100 before the search runs, so `pagination.limit` is 100 and `total_pages`, `has_next` and page offsets follow it. Legacy alias `per_page` is accepted and will be removed in v2."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Search keyword (alias: `query`)"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Comma-separated category UUIDs"},"required":false,"name":"category_ids","in":"query"},{"schema":{"type":"string","description":"Comma-separated tag UUIDs"},"required":false,"name":"tag_ids","in":"query"},{"schema":{"type":"string","description":"Comma-separated badge UUIDs"},"required":false,"name":"badge_ids","in":"query"},{"schema":{"type":["number","null"],"description":"Latitude (alias: `latitude`)"},"required":false,"name":"lat","in":"query"},{"schema":{"type":["number","null"],"description":"Longitude (alias: `longitude`)"},"required":false,"name":"lng","in":"query"},{"schema":{"type":["number","null"],"description":"Search radius in km (alias: `radius_km`)"},"required":false,"name":"radius","in":"query"},{"schema":{"type":"string","enum":["relevance","distance","name","created_at","view_count","rating"],"description":"Sort field (canonical)"},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"],"description":"Sort direction (canonical)"},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"number","minimum":1,"maximum":5,"description":"Minimum average rating (1 to 5) a listing must meet"},"required":false,"name":"rating","in":"query"},{"schema":{"type":["boolean","null"],"description":"When true, return only featured listings"},"required":false,"name":"featured","in":"query"},{"schema":{"type":"string","description":"Comma-separated category UUIDs to exclude (subtree-expanded); alias `exclude_category_ids`"},"required":false,"name":"excludeCategories","in":"query"},{"schema":{"type":"string","description":"Custom-field equality/set-membership filter, bracket-keyed by the field key: `custom_fields[education_level]=masters` or `custom_fields[education_level]=masters,phd` (comma = OR). The key must be one of the account's configured search filters (422 otherwise)."},"required":false,"name":"custom_fields[<key>]","in":"query"},{"schema":{"type":"string","description":"Inclusive lower bound for a number/date range filter: `custom_fields[years_experience][min]=5`. Either bound is independently omittable; at least one is required."},"required":false,"name":"custom_fields[<key>][min]","in":"query"},{"schema":{"type":"string","description":"Inclusive upper bound, paired with the `[min]` param above."},"required":false,"name":"custom_fields[<key>][max]","in":"query"},{"schema":{"type":"string","description":"Configured text-search filter, bracket-keyed by the filter id: `text_filters[<id>]=<string>`. The id must be one of the account's configured text-search filters (422 otherwise). A filter matches a listing when any field it is configured to search contains the text, ignoring letter case, with `%` and `_` matched literally. A filter configured with a location component (suburb, state or postcode) matches when any of the listing's public locations has that component containing the text, so `text_filters[<id>]=3121` matches postcode 3121 and `text_filters[<id>]=rich` matches the suburb Richmond."},"required":false,"name":"text_filters[<id>]","in":"query"},{"schema":{"type":"string","description":"Configured location dropdown filter, bracket-keyed by the filter id: `location_filters[<id>]=NSW,VIC,QLD`. Resolves against city, state, postcode, or country depending on the filter's configured component. Discover an account's configured filter ids, components and labels with `GET /v1/directory/facets?fields=location_filters`."},"required":false,"name":"location_filters[<id>]","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of cities to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial: `city=newcastle` matches a stored `Newcastle` but not `Newcastle West`. Available on every account regardless of its configured search filters. May be combined with `location_filters[<id>]` filters on the same or a different component (applied as separate, ANDed entries); at most 8 location filters (named plus `location_filters[<id>]`) total. Cannot be combined with `suburb`."},"required":false,"name":"city","in":"query"},{"schema":{"type":"string","description":"Alias for `city` (Australian addressing). Comma-separated, case-insensitive exact matching, same rules as `city`. Cannot be combined with `city` in the same request (422 naming both)."},"required":false,"name":"suburb","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of states to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial. Available on every account regardless of its configured search filters."},"required":false,"name":"state","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of postcodes to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial. Available on every account regardless of its configured search filters."},"required":false,"name":"postcode","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of countries to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact against the value as stored. `listing_locations.country` carries no normalisation, so an account may hold `AU`, `Australia` and `australia` on different rows. Discover an account's real values with `GET /v1/directory/facets?fields=location.country`."},"required":false,"name":"country","in":"query"},{"schema":{"type":"string","description":"Case-insensitive literal substring match on listing location names. A listing is returned when at least one of its listing locations has a name containing this text, ignoring letter case, so a value of `vincent` matches a location named `St Vincent's Hospital`. It is a literal substring match: `_` and `%` have no special meaning and match only themselves. Typographic and ASCII apostrophes are treated alike. The value is trimmed, a blank value is ignored, and a value over 100 characters is a 422. It applies per listing rather than per location: combined with another filter, a listing is returned when each filter is satisfied by some location of it, not necessarily the same one. It matches listing location names only, and does not refer to the organisation the API key belongs to. Available on every account regardless of its configured search filters. Takes exactly one value and is never split on commas, so `Smith, Jones` is one value: a repeated `locationName` key, or a bracket-indexed `locationName[0]` key, is a 422."},"required":false,"name":"locationName","in":"query"},{"schema":{"type":"string","description":"Bounding box as `north,south,east,west` decimal degrees. Mutually exclusive with `lat`/`lng`/`radius` (422 when both are supplied)."},"required":false,"name":"bbox","in":"query"},{"schema":{"type":"string","description":"Comma-separated, or a repeated key whose values are merged, so `include=a,b` and `include=a&include=b` are the same request; a repeated value counts once. Optional properties to add to every search card. Recognised: `categories`, every active category linked to the listing, ordered by name; and `phone`, the listing's public phone, which is null when the organisation hides phone in its directory form settings or an active field group withholds it from public visitors, whatever bearer token is supplied. Any other value is ignored rather than rejected, so a misspelt value returns the cards without that property. `include` only ever adds a property: it never changes which listings are returned, their order or `pagination`, whether or not the organisation shows phone. `email` is not a recognised value."},"required":false,"name":"include","in":"query"},{"schema":{"type":"string","description":"Comma-separated, or a repeated key whose values are merged. Optional. The custom fields each card should carry, named as `custom.<field_key>`, the facets vocabulary. Each card's `custom_fields` then holds only named fields that are active and shown on cards, each exactly as it would be without `fields`: a value the caller may read, otherwise a gate. A name with no such field is skipped without an error. Present and empty returns every card with an empty `custom_fields`. Omitted returns every card field, as before. `fields` only narrows: it never changes which listings are returned, their order or `pagination`, and never returns a field the request without it would not. An entry that is not `custom.<field_key>` is refused. A malformed entry is a 422."},"required":false,"name":"fields","in":"query"}],"responses":{"200":{"description":"Paginated keyword-search results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DirectorySearchResult"}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized — missing/invalid API key, or an invalid/expired member bearer token when one was supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"An unconfigured custom-field/text-filter/location-filter key or id, a malformed range (neither bound, or min greater than max), bbox supplied alongside a distance filter, city and suburb supplied together, a named location filter with more than 50 values or a value over 100 characters, named plus location_filters[<id>] filters together exceeding 8 entries, a location name over 100 characters or not a single value (`locationName` repeated or bracket-indexed on GET, `location_name` an array on POST), or a `fields` entry that is not `custom.<field_key>`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Directory"],"summary":"Search directory listings (keyword mode, JSON body)","description":"Same behaviour as GET /v1/directory/search but accepts a JSON body instead of query params. Used by integrators that prefer to send filters in the request body. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key (SPEC-DIR-20260730-directory-member-field-access US-3.1; SPEC-DIR-20260902-directory-api-parity US-2.2/US-2.3): an invalid or expired bearer is rejected (401); an absent bearer serves the anonymous response unchanged. Custom fields and gated-filter matching elevate on the same bearer-only basis as the GET form. Listing location coordinates may come from Amazon Location Service. A client displaying them, on a map or otherwise, shows the credit \"Locations: Amazon Location Service\" linked to the AWS data attribution page, https://docs.aws.amazon.com/location/latest/developerguide/data-attribution.html.","security":[{"apiKey":["directory.listings.search"]},{"apiKey":["directory.listings.search"],"userBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string"},"filters":{"type":"object","properties":{"keyword":{"type":"string"},"category_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"tag_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"badge_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"location":{"type":"object","properties":{"latitude":{"type":"number","minimum":-90,"maximum":90},"longitude":{"type":"number","minimum":-180,"maximum":180},"radius_km":{"type":"number","minimum":1,"maximum":1000}},"required":["latitude","longitude","radius_km"]},"bbox":{"type":"object","properties":{"north":{"type":"number","minimum":-90,"maximum":90},"south":{"type":"number","minimum":-90,"maximum":90},"east":{"type":"number","minimum":-180,"maximum":180},"west":{"type":"number","minimum":-180,"maximum":180}},"required":["north","south","east","west"],"description":"Mutually exclusive with `location` (422 when both are supplied)."},"sponsor_level":{"anyOf":[{"type":"number","enum":[0]},{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"type":"number","enum":[3]}]},"min_rating":{"type":"number","minimum":1,"maximum":5},"featured":{"type":"boolean"},"exclude_category_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"custom_fields":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"kind":{"type":"string","enum":["number","date","datetime"]},"min":{"anyOf":[{"type":"string"},{"type":"number"}]},"max":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":["kind"]}]},"description":"Keyed by field key. Value is a scalar (equality), an array (OR set membership), or a range object. The key must be one of the account's configured search filters (422 otherwise); a range with neither bound, or with min greater than max, is also 422."},"text_filters":{"type":"object","additionalProperties":{"type":"string"},"description":"Keyed by the configured text-search filter's id. A filter matches a listing when any field it is configured to search contains the text, ignoring letter case, with % and _ matched literally. A filter configured with a location component (suburb, state or postcode) matches when any of the listing's public locations has that component containing the text."},"location_filters":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"Keyed by the configured location-facet filter's id. Discover an account's configured filter ids, components and labels with GET /v1/directory/facets?fields=location_filters."},"city":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"City to match, as a string or an array of strings; array values are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial. Available on every account regardless of its configured search filters. May be combined with location_filters on the same or a different component (applied as separate, ANDed entries); at most 8 location filters (named plus location_filters) total. Cannot be combined with suburb."},"suburb":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Alias for city (Australian addressing). Case-insensitive exact matching, same rules as city. Cannot be combined with city in the same request (422 naming both)."},"state":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"State to match, as a string or an array of strings; array values are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial. Available on every account regardless of its configured search filters."},"postcode":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Postcode to match, as a string or an array of strings; array values are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial. Available on every account regardless of its configured search filters."},"country":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Country to match, as a string or an array of strings; array values are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact against the value as stored. listing_locations.country carries no normalisation, so an account may hold AU, Australia and australia on different rows. Discover an account's real values with GET /v1/directory/facets?fields=location.country."},"location_name":{"type":"string","description":"Case-insensitive literal substring match on listing location names. A listing is returned when at least one of its listing locations has a name containing this text, ignoring letter case, so a value of `vincent` matches a location named `St Vincent's Hospital`. It is a literal substring match: `_` and `%` have no special meaning and match only themselves. Typographic and ASCII apostrophes are treated alike. The value is trimmed, a blank value is ignored, and a value over 100 characters is a 422. It applies per listing rather than per location: combined with another filter, a listing is returned when each filter is satisfied by some location of it, not necessarily the same one. It matches listing location names only, and does not refer to the organisation the API key belongs to. Available on every account regardless of its configured search filters. Takes one string and is never split on commas; an array is a 422."}}},"sort":{"type":"object","properties":{"field":{"type":"string","enum":["relevance","distance","name","created_at","view_count","rating"]},"direction":{"type":"string","enum":["asc","desc"]}},"required":["field","direction"]},"page":{"type":"integer","minimum":1},"limit":{"type":"integer","minimum":1,"maximum":100},"include":{"type":"array","items":{"type":"string"},"description":"An array of strings; a repeated value counts once, and a value that is not an array of strings is ignored as though absent. Optional properties to add to every search card. Recognised: `categories`, every active category linked to the listing, ordered by name; and `phone`, the listing's public phone, which is null when the organisation hides phone in its directory form settings or an active field group withholds it from public visitors, whatever bearer token is supplied. Any other value is ignored rather than rejected, so a misspelt value returns the cards without that property. `include` only ever adds a property: it never changes which listings are returned, their order or `pagination`, whether or not the organisation shows phone. `email` is not a recognised value."},"fields":{"type":"array","items":{"type":"string"},"description":"An array of strings. Optional. The custom fields each card should carry, named as `custom.<field_key>`, the facets vocabulary. Each card's `custom_fields` then holds only named fields that are active and shown on cards, each exactly as it would be without `fields`: a value the caller may read, otherwise a gate. A name with no such field is skipped without an error. Present and empty returns every card with an empty `custom_fields`. Omitted returns every card field, as before. `fields` only narrows: it never changes which listings are returned, their order or `pagination`, and never returns a field the request without it would not. An entry that is not `custom.<field_key>` is refused. A malformed entry is a 400."}}}}}},"responses":{"200":{"description":"Paginated keyword-search results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DirectorySearchResultPost"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized — missing/invalid API key, or an invalid/expired member bearer token when one was supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"An unconfigured custom-field/text-filter/location-filter key or id, a malformed range (neither bound, or min greater than max), bbox supplied alongside a distance filter, city and suburb supplied together, a named location filter with more than 50 values or a value over 100 characters, named plus location_filters[<id>] filters together exceeding 8 entries, or a location name over 100 characters or not a single value (`locationName` repeated or bracket-indexed on GET, `location_name` an array on POST)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/markers":{"get":{"tags":["Directory"],"summary":"List directory map markers","description":"Returns every listing matching the same filters as `GET /v1/directory/search`, as map markers: id, slug, name, logo, primary category, rating summary, and each geocoded location with its name and coordinates, one pin each. Built from the reduced `search_listings` marker row, so tags, badges, descriptions and custom fields are not included; use search or the listing detail for those. Pass `bbox` to fetch the markers in the visible map area, or `lat`, `lng` and `radius` for a radius search, which also gives each marker `distance_km`. There is no `page`: one response carries the matching set up to `limit` (1 to 2000, default 500), ordered by `sortBy` like search, and `meta.truncated` is true when more listings matched. Pass `projection=points` for map points instead: each listing's id, name and geocoded coordinates, up to 20000 listings (the default `limit` in that projection), so a map can place every matching listing from one request. Pass `ids` to fetch the map markers (or map points) of chosen listings, such as the one whose pin a visitor opened. A markers fetch is not logged as a search. Requires the `directory.listings.search` scope. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: gated filters then match against the values that token is entitled to, exactly as on search; an invalid or expired bearer is rejected (401). Listing location coordinates may come from Amazon Location Service. A client displaying them, on a map or otherwise, shows the credit \"Locations: Amazon Location Service\" linked to the AWS data attribution page, https://docs.aws.amazon.com/location/latest/developerguide/data-attribution.html.","security":[{"apiKey":["directory.listings.search"]},{"apiKey":["directory.listings.search"],"userBearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":20000,"description":"Maximum listings to return. Map markers: 1 to 2000 (default 500). Map points (`projection=points`): 1 to 20000 (default 20000, the whole set up to that cap). `meta.truncated` is true when more listings matched."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Search keyword (alias: `query`)"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Comma-separated category UUIDs"},"required":false,"name":"category_ids","in":"query"},{"schema":{"type":"string","description":"Comma-separated tag UUIDs"},"required":false,"name":"tag_ids","in":"query"},{"schema":{"type":"string","description":"Comma-separated badge UUIDs"},"required":false,"name":"badge_ids","in":"query"},{"schema":{"type":["number","null"],"description":"Latitude (alias: `latitude`)"},"required":false,"name":"lat","in":"query"},{"schema":{"type":["number","null"],"description":"Longitude (alias: `longitude`)"},"required":false,"name":"lng","in":"query"},{"schema":{"type":["number","null"],"description":"Search radius in km (alias: `radius_km`)"},"required":false,"name":"radius","in":"query"},{"schema":{"type":"string","enum":["relevance","distance","name","created_at","view_count","rating"],"description":"Sort field (canonical)"},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"],"description":"Sort direction (canonical)"},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"number","minimum":1,"maximum":5,"description":"Minimum average rating (1 to 5) a listing must meet"},"required":false,"name":"rating","in":"query"},{"schema":{"type":["boolean","null"],"description":"When true, return only featured listings"},"required":false,"name":"featured","in":"query"},{"schema":{"type":"string","description":"Comma-separated category UUIDs to exclude (subtree-expanded); alias `exclude_category_ids`"},"required":false,"name":"excludeCategories","in":"query"},{"schema":{"type":"string","description":"Custom-field equality/set-membership filter, bracket-keyed by the field key: `custom_fields[education_level]=masters` or `custom_fields[education_level]=masters,phd` (comma = OR). The key must be one of the account's configured search filters (422 otherwise)."},"required":false,"name":"custom_fields[<key>]","in":"query"},{"schema":{"type":"string","description":"Inclusive lower bound for a number/date range filter: `custom_fields[years_experience][min]=5`. Either bound is independently omittable; at least one is required."},"required":false,"name":"custom_fields[<key>][min]","in":"query"},{"schema":{"type":"string","description":"Inclusive upper bound, paired with the `[min]` param above."},"required":false,"name":"custom_fields[<key>][max]","in":"query"},{"schema":{"type":"string","description":"Configured text-search filter, bracket-keyed by the filter id: `text_filters[<id>]=<string>`. The id must be one of the account's configured text-search filters (422 otherwise). A filter matches a listing when any field it is configured to search contains the text, ignoring letter case, with `%` and `_` matched literally. A filter configured with a location component (suburb, state or postcode) matches when any of the listing's public locations has that component containing the text, so `text_filters[<id>]=3121` matches postcode 3121 and `text_filters[<id>]=rich` matches the suburb Richmond."},"required":false,"name":"text_filters[<id>]","in":"query"},{"schema":{"type":"string","description":"Configured location dropdown filter, bracket-keyed by the filter id: `location_filters[<id>]=NSW,VIC,QLD`. Resolves against city, state, postcode, or country depending on the filter's configured component. Discover an account's configured filter ids, components and labels with `GET /v1/directory/facets?fields=location_filters`."},"required":false,"name":"location_filters[<id>]","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of cities to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial: `city=newcastle` matches a stored `Newcastle` but not `Newcastle West`. Available on every account regardless of its configured search filters. May be combined with `location_filters[<id>]` filters on the same or a different component (applied as separate, ANDed entries); at most 8 location filters (named plus `location_filters[<id>]`) total. Cannot be combined with `suburb`."},"required":false,"name":"city","in":"query"},{"schema":{"type":"string","description":"Alias for `city` (Australian addressing). Comma-separated, case-insensitive exact matching, same rules as `city`. Cannot be combined with `city` in the same request (422 naming both)."},"required":false,"name":"suburb","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of states to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial. Available on every account regardless of its configured search filters."},"required":false,"name":"state","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of postcodes to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact, not partial. Available on every account regardless of its configured search filters."},"required":false,"name":"postcode","in":"query"},{"schema":{"type":"string","description":"Comma-separated list, or a repeated key, of countries to match; values within the list are ORed. Values must not contain a double quote or a backslash. Matching is case-insensitive exact against the value as stored. `listing_locations.country` carries no normalisation, so an account may hold `AU`, `Australia` and `australia` on different rows. Discover an account's real values with `GET /v1/directory/facets?fields=location.country`."},"required":false,"name":"country","in":"query"},{"schema":{"type":"string","description":"Case-insensitive literal substring match on listing location names. A listing is returned when at least one of its listing locations has a name containing this text, ignoring letter case, so a value of `vincent` matches a location named `St Vincent's Hospital`. It is a literal substring match: `_` and `%` have no special meaning and match only themselves. Typographic and ASCII apostrophes are treated alike. The value is trimmed, a blank value is ignored, and a value over 100 characters is a 422. It applies per listing rather than per location: combined with another filter, a listing is returned when each filter is satisfied by some location of it, not necessarily the same one. It matches listing location names only, and does not refer to the organisation the API key belongs to. Available on every account regardless of its configured search filters. Takes exactly one value and is never split on commas, so `Smith, Jones` is one value: a repeated `locationName` key, or a bracket-indexed `locationName[0]` key, is a 422."},"required":false,"name":"locationName","in":"query"},{"schema":{"type":"string","description":"Bounding box as `north,south,east,west` decimal degrees. Mutually exclusive with `lat`/`lng`/`radius` (422 when both are supplied)."},"required":false,"name":"bbox","in":"query"},{"schema":{"type":"string","enum":["markers","points"],"description":"The shape of each listing in `data`. `markers` (the default) returns map markers. `points` returns map points: each listing's `id`, `name` and the coordinates of its geocoded locations, and nothing else, so a map can draw every matching listing from one response and fetch a pin's marker with `ids` when it is opened. Both select the same listings in the same order, with the same `total` and `meta.truncated` for the same `limit`. Any other value is a 400."},"required":false,"name":"projection","in":"query"},{"schema":{"type":"string","description":"Comma-separated listing UUIDs, 1 to 100. Narrows the response to the named listings that match every other parameter on the request; it never widens it. A named listing that does not match, does not exist, belongs to another organisation, or is not publicly listed is absent, with no error, so one with no visible match returns 200 with an empty `data`. A value that is not a UUID, an empty list, more than 100 values or a repeated `ids` key is a 400. Accepted in both projections."},"required":false,"name":"ids","in":"query"}],"responses":{"200":{"description":"Matching listings as map markers, or as map points with `projection=points`. `meta.truncated` is true when more listings matched than `limit`.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DirectoryMapMarker"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]},{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DirectoryMapPoint"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}]}}}},"400":{"description":"Invalid query parameters: `projection` other than `markers` or `points`, `limit` outside 1 to 2000 (1 to 20000 with `projection=points`), or an `ids` value that is not 1 to 100 comma-separated UUIDs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or an invalid or expired bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"The same filter violations as `GET /v1/directory/search`: an unconfigured filter key or id, a malformed range, bbox supplied alongside a distance filter, city and suburb together, a named location filter over its caps, or a `locationName` over 100 characters, repeated or bracket-indexed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/geocode":{"get":{"tags":["Directory"],"summary":"Geocode an address or place for a directory map","description":"Resolves a free-form address, suburb or postcode to a point, for centring a map or starting a radius search (pass the result as `lat`/`lng` to search or markers). Results are cached durably, so a repeated query is answered without calling the geocoder (with `display_name` null). Requires the `directory.listings.search` scope, and the account must hold the `directory.geocoding` feature (403 otherwise; `GET /v1/directory/map-settings` reports it as `geocoding_available`). Rate limited per API key in its own bucket, separate from search (429). Responds 404 when nothing matches, and 503 with `Retry-After` when the geocoder cannot answer, so an outage is never mistaken for a place that does not exist. Results are OpenStreetMap data. A client displaying them shows the credit \"© OpenStreetMap contributors\" linked to the OpenStreetMap copyright page, https://www.openstreetmap.org/copyright.","security":[{"apiKey":["directory.listings.search"]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"The address, suburb or postcode to resolve, 1 to 200 characters, for example `2150 Parramatta NSW`."},"required":true,"name":"q","in":"query"}],"responses":{"200":{"description":"The best match","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DirectoryGeocodeResult"}},"required":["success","data"]}}}},"400":{"description":"`q` missing, empty, or over 200 characters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The key lacks the scope, or the account does not hold the directory.geocoding feature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No place matched `q`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"The API key exceeded its geocode rate limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"The geocoder could not answer (`SERVICE_UNAVAILABLE`, with `Retry-After`). Retry later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/map-settings":{"get":{"tags":["Directory"],"summary":"Get the directory map settings","description":"Returns what a map needs to choose its starting view: the account's configured default centre, the envelope of its publicly visible geocoded listings (for fitting every pin on first paint), and whether address geocoding is available. Requires the `directory.listings.search` scope.","security":[{"apiKey":["directory.listings.search"]}],"responses":{"200":{"description":"The map settings","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DirectoryMapSettings"}},"required":["success","data"]}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/listings/{slugOrId}/reviews":{"get":{"tags":["Directory"],"summary":"List a listing's approved reviews","description":"Returns approved reviews for the listing (resolved by slug or UUID), most-recent-first. reviewer_email and verification_token are never included. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: when valid, each review carries `is_mine` (true for the caller's own reviews, matched by their contact email — the email itself is never exposed); an invalid bearer is rejected. Absent for anonymous callers.","security":[{"apiKey":["directory.reviews.browse"]},{"apiKey":["directory.reviews.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","description":"Listing slug or UUID"},"required":true,"name":"slugOrId","in":"path"},{"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (1-based)"},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Results per page (1–100). Legacy alias `per_page` is accepted on listings/search and will be removed in v2."},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Paginated approved reviews","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DirectoryReviewList"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden — includes `REVIEWS_DISABLED` when the organisation has disabled reviews directory-wide","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Listing not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/reviews":{"post":{"tags":["Directory"],"summary":"Submit a review for a business listing","description":"Returns the persisted review with sensitive fields stripped (`verification_token`, `reviewer_email`). `meta.requires_verification: true` indicates the reviewer must complete email verification before the review is published. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key (SPEC-CORE-20260722 US-2.2 AC2, Decision 2.10): when valid, `reviewer_name`/`reviewer_email` may be omitted — both are derived from the caller's CRM contact (the contact's email always wins over any client-supplied value, to prevent impersonation), and the review is created already verified, skipping the email round-trip (`meta.requires_verification: false`). Moderation approval is unaffected either way. The guest contract (no bearer) is unchanged: `reviewer_name`/`reviewer_email` are then required in the body.","security":[{"apiKey":["directory.reviews.manage"]},{"apiKey":["directory.reviews.manage"],"userBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"listing_id":{"type":"string","format":"uuid"},"rating":{"type":"number","minimum":1,"maximum":5},"reviewer_name":{"type":"string","minLength":2,"maxLength":100},"reviewer_email":{"type":"string","format":"email"},"content":{"type":"string","minLength":20,"maxLength":2000}},"required":["listing_id","rating","content"]}}}},"responses":{"201":{"description":"Review submitted; awaiting email verification","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DirectoryReview"}},"required":["success","data"]}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden — includes `REVIEWS_DISABLED` when the organisation has disabled reviews directory-wide","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/listings/{slugOrId}/enquiries":{"post":{"tags":["Directory"],"summary":"Send an enquiry to a listing's owner","description":"Emails the listing's address with `Reply-To` set to the visitor, sends the visitor a courtesy copy, and also emails the organisation's enquiry copy address when one is set. The caller is a trusted server (typically a client website) and is responsible for verifying a captcha first; this endpoint accepts none. The listing's address is never returned. Requires the `directory.enquiries.send` scope. Rate limited per API key (the standard gateway limit: the key's own limit when set, otherwise 60 requests a minute) and per visitor IP (5 per 10 minutes, matching the hosted directory contact form). The optional `x-agend-visitor-ip` header names the visitor's IP and is used as the per-visitor rate limit key; it is honoured only for an API key request, must be a valid IPv4 or IPv6 address (400 `BAD_REQUEST` otherwise), and falls back to the forwarded client IP when absent. A listing that is unknown, unpublished or in another organisation answers 404 `NOT_FOUND`; a listing with no email address answers 409 `LISTING_NOT_ACCEPTING_ENQUIRIES`; an organisation with a listing contact terms link requires `terms_accepted: true` (422 `TERMS_REQUIRED`).","security":[{"apiKey":["directory.enquiries.send"]}],"parameters":[{"schema":{"type":"string","description":"Listing slug or UUID"},"required":true,"name":"slugOrId","in":"path"},{"schema":{"type":"string","description":"The visitor IP address, used as the per-visitor rate limit key. Honoured only for API key requests."},"required":false,"name":"x-agend-visitor-ip","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string","minLength":1,"maxLength":100},"last_name":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","maxLength":254,"format":"email"},"phone":{"type":"string","maxLength":40},"message":{"type":"string","minLength":10,"maxLength":5000},"terms_accepted":{"type":"boolean"}},"required":["first_name","last_name","email","message"]}}}},"responses":{"200":{"description":"Enquiry sent","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DirectoryEnquirySent"}},"required":["success","data"]}}}},"400":{"description":"Invalid request body (`VALIDATION_ERROR`) or invalid `x-agend-visitor-ip` header (`BAD_REQUEST`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden: the key lacks `directory.enquiries.send`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Listing not found (`NOT_FOUND`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The listing has no email address (`LISTING_NOT_ACCEPTING_ENQUIRIES`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"The organisation requires terms acceptance (`TERMS_REQUIRED`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The enquiry email could not be sent (`INTERNAL_ERROR`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/me/listing":{"get":{"tags":["Directory"],"summary":"Get the authenticated member's own directory listing","description":"Resolves the calling member's own listing via the same `member_listings` resolution the PATCH variant uses (scoped by user id and account), then returns the full public listing detail shape (SPEC-CORE-20260722 US-2.2 AC1) — the same shape `GET /v1/directory/listings/{slugOrId}` returns, so `badges` omits every inactive listing badge. Returns `null` when the member has no listing. Requires a user bearer token. Listing location coordinates may come from Amazon Location Service. A client displaying them, on a map or otherwise, shows the credit \"Locations: Amazon Location Service\" linked to the AWS data attribution page, https://docs.aws.amazon.com/location/latest/developerguide/data-attribution.html.","security":[{"apiKey":["directory.listings.browse"],"userBearer":[]}],"responses":{"200":{"description":"The member's own listing, or null when they have none","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"allOf":[{"$ref":"#/components/schemas/DirectoryListingDetail"},{"type":["object","null"]}]}},"required":["success","data"]}}}},"401":{"description":"Unauthorized — missing/invalid API key or user token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["Directory"],"summary":"Update the authenticated member's own directory listing settings","description":"Sets the calling member's directory listing options (currently the `dms_open` direct-message opt-in). Identity is taken from the bearer token; the target `member_listings` row is resolved server-side from the user id, so a caller can only ever mutate their own row. Requires the dedicated `directory.listings.self_update` scope (distinct from the elevated `directory.listings.manage`) plus a user bearer token.","security":[{"apiKey":["directory.listings.self_update"],"userBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dms_open":{"type":"boolean"}},"required":["dms_open"]}}}},"responses":{"200":{"description":"Listing settings updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DirectoryMyListingUpdate"}},"required":["success","data"]}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized — missing/invalid API key or user token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden — key lacks directory.listings.self_update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/facets":{"get":{"tags":["Directory"],"summary":"Enumerate directory facets and the values that exist for each","description":"Returns the filterable dimensions of the directory: categories, tags, badges, location values, configured location filters, and readable custom fields, together with the values that exist for each, so a filter control can be built without knowing the value space in advance (SPEC-DIR-20260902-directory-api-parity Epic 3; SPEC-DIR-20260909-directory-api-location-filters Epic 2). `fields` selects specific facets by name: `categories`, `tags`, `badges`, `custom.<field_key>` for a custom field, `location.city`, `location.suburb` (alias for `location.city`), `location.state`, `location.postcode`, `location.country`, or `location_filters` for the account's configured location dropdowns. Omitted, every facet the caller may read is returned, including all four location facets and `location_filters`. A location facet's `values` are the distinct values across the account's published listings, sourced from the same values that filter matches against, deduped case-insensitively and sorted; a component with none returns `values: []` rather than being omitted, since the location vocabulary is structural and identical on every account (no field-existence disclosure to protect, unlike a custom field). A location facet's label is the account's own configured label for that component where a location dropdown is configured, otherwise the component default (`City`, `State`, `Postcode`, `Country`); the response key stays `location.<component>` regardless of the label. `location_filters` is a collection: one entry per non-hidden configured location dropdown, each carrying `id`, `component`, `label` and the same `values` its `location.<component>` entry carries, or an empty collection when the account has configured none. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: a key-only request receives exactly the publicly visible facet set; a valid bearer additionally elevates the custom-field facet set to that token's viewer entitlement. A custom field the caller is not entitled to read is ABSENT from `data` whether or not it was named explicitly in `fields`: naming a gated field and naming a field that does not exist produce identical responses, so the endpoint is never a probe for an account's field schema. Location facets and `location_filters` carry no such gating. A custom-field facet for a number range filter carries `min` and `max` from the values the caller can see and, when the account has configured preset brackets for that filter, an optional `presets` array in display order, each entry a `label` with an optional `min` and an optional `max` (for example `Under 10,000` with only `max: 9999`, then `10,000 to 30,000` with `min: 10000` and `max: 30000`). An omitted bound is open-ended, both bounds are inclusive, and `presets` is absent (never an empty array) when none are configured. A preset `label` is administrator-authored plain text, so escape it on output. Presets are static configuration, so they never reflect the caller's entitlement; they appear only inside an entry the caller is already entitled to read. Apply one by sending its bounds as `custom_fields[<key>][min]` and `custom_fields[<key>][max]` on `/v1/directory/search`, one preset at a time; a caller may ignore them and offer its own brackets. A response for an identified viewer carries `Cache-Control: private, no-store`.","security":[{"apiKey":["directory.listings.browse"]},{"apiKey":["directory.listings.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","description":"Comma-separated facet names: `categories`, `tags`, `badges`, `custom.<field_key>`, `location.city`, `location.suburb`, `location.state`, `location.postcode`, `location.country`, `location_filters`. Omitted returns every facet the caller may read."},"required":false,"name":"fields","in":"query"}],"responses":{"200":{"description":"A map keyed by facet name, one entry per requested (or every readable) facet. Every key holds a single facet entry except `location_filters`, which holds a collection of the account's configured location filters.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DirectoryFacetsMap"}},"required":["success","data"]}}}},"401":{"description":"Unauthorized — missing/invalid API key, or an invalid/expired member bearer token when one was supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"An unrecognised facet name in `fields`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/export-reports":{"get":{"tags":["Directory"],"summary":"List the published export reports the caller may run","description":"Returns the published export reports whose audience the caller satisfies (SPEC-DIR-20260902-directory-api-parity US-4.2), together with the report parameters each accepts. A `restricted` report the caller does not satisfy, or a report that is not published, is ABSENT rather than present with a denial marker (Decision 2.7's fail-closed rule applied to export reports). Column definitions are not exposed here — a consumer learns the columns from a downloaded file's header row. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: a key-only request sees only `anonymous`-audience reports; a valid bearer additionally surfaces `members_only` and entitled `restricted` reports (Decision 2.11). A bearer identifying a caller who holds `directory.settings.manage` on the account sees every published report regardless of audience or held entitlement/segment — the same account-manager carve-out that gates authoring these reports (Decision 2.15). A report that is not published stays absent even for a manager. `?scope=all` returns every PUBLISHED report for the account regardless of audience, each with its `audience`, for authoring surfaces such as page builders; it requires the API key to hold the `directory.listings.manage` scope and returns 403 without it, an unpublished report stays absent, and a bearer token is ignored in this mode.","security":[{"apiKey":["directory.export_reports.browse"]},{"apiKey":["directory.export_reports.browse"],"userBearer":[]},{"apiKey":["directory.export_reports.browse","directory.listings.manage"]}],"parameters":[{"schema":{"type":"string","enum":["all"],"description":"Set to `all` to return every published report regardless of audience, for authoring surfaces. Requires the directory.listings.manage scope; 403 without it. Omitted returns the audience-filtered list."},"required":false,"name":"scope","in":"query"}],"responses":{"200":{"description":"The export reports available to the caller","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DirectoryExportReportSummary"}}},"required":["success","data"]}}}},"401":{"description":"Unauthorized — missing/invalid API key, or an invalid/expired member bearer token when one was supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden — the account does not hold the directory.export_reports tenant feature, or scope=all was requested without the directory.listings.manage scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"An unrecognised value for scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/directory/export-reports/{reportId}":{"get":{"tags":["Directory"],"summary":"Execute a published export report and download the file","description":"Executes the named report, applying any supplied report-parameter overrides, and returns the resulting file directly — real content type, `Content-Disposition: attachment` — rather than the `{success, data}` envelope every other `/v1` route uses (Decision 2.12, documented as an exception in `.claude/rules/public-api.md`). A report parameter's wire name is its `condition_id` (surfaced by `GET /v1/directory/export-reports`'s `parameters` array); its value follows the shape the report's own stored condition already has (comma-separated for a facet list, `<name>[min]`/`<name>[max]` for a range, matching Decision 2.3's bracket convention). A parameter name the report has not declared overridable is ignored and the export runs on the report's stored conditions unchanged, with a 200; a declared parameter supplied with an empty value clears that filter, dropping its condition from the query rather than applying an empty value. `city`, `suburb`, `state`, `postcode` and `country` additionally address a user-definable `location.<component>` parameter slot by component name rather than its opaque `condition_id` (SPEC-DIR-20260909-directory-api-location-filters US-4.1): where the report declares exactly one such slot the named form fills it identically to supplying its `condition_id`; where it declares none or more than one, the named parameter is silently ignored and the export runs on the report's stored conditions unchanged, with no error and no disclosure of which of the two is the case. Supplying a named location parameter alongside that same slot's own `condition_id` key is a 422 naming both. A request for an unpublished report, a foreign-tenant report, or a nonexistent report all return byte-identical 404s, so report existence is never disclosed — this holds even for a caller who manages reports (see below). A report that IS published and in the caller's own account, but whose audience the caller does not satisfy, is the one case answered with a 403 instead: the body carries `sign_in_required` when no session identified the caller, `membership_required` when the caller is signed in but is not a contact of this organisation, and `entitlement_required` when the caller is a contact holding neither a listed entitlement nor a listed segment. Each message says what would change the outcome and never names the report's audience, entitlement keys or segment ids. A cell the caller is not entitled to see carries the report's `restricted_value_message`, never the underlying value, in every format. A report can instead be configured to leave out any listing where a field the report shows, sorts by or filters on is restricted for the caller; a list report's row limit then counts only the listings returned. A field on one of the report's extra sheets counts as a field the report shows: a listing restricted in any sheet column, sort field, group level or calculation is left out of the whole report, the main sheet and every other sheet included. A report with extra sheets reads every listing its filters return, up to the row cap, so each sheet can keep its own rows; the report's row limit and sort then apply to the main sheet alone, and an extra sheet never takes its order from the report's sort. When the filters return more listings than the row cap, the cap keeps the first listings in the report's own sort order. A report can also be set to return every value to every caller its audience admits, in which case no cell carries the `restricted_value_message` and no listing is left out, while the audience check above is unchanged. A result exceeding the row cap is truncated, carries `X-Agend-Truncated-At`, and ends with a truncation row/notice. Rate limiting is keyed on the API key, never the caller's IP. A bearer identifying a caller who holds `directory.settings.manage` on the account both runs a `restricted` report they hold no entitlement for and receives every cell ungated, with no `restricted_value_message` substitution (Decision 2.15) — a published report remains the only requirement.","security":[{"apiKey":["directory.export_reports.run"]},{"apiKey":["directory.export_reports.run"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Export report UUID"},"required":true,"name":"reportId","in":"path"},{"schema":{"type":"string","enum":["csv","xlsx"],"description":"Output format. Defaults to `csv`, so every caller predating US-4.4 is unaffected. A report whose author configured extra sheets holds more than one table, so it defaults to `xlsx` instead and an explicit `csv` request is a 422."},"required":false,"name":"format","in":"query"},{"schema":{"type":"string","description":"Any of the report's own declared parameter names (see `GET /v1/directory/export-reports`'s `parameters[].name`), value-shaped to match that parameter's stored condition. A facet parameter's values may be supplied as a comma-separated list (`?<name>=a,b`) or as a repeated key (`?<name>=a&<name>=b`); both OR the values together. A parameter name this report has not declared overridable is ignored and the export runs on the report's stored conditions, so one caller may send a whole catalogue's filter set to any report; check `parameters[]` to confirm which names a given report honours, because an ignored parameter is not reported. Supplying a declared parameter with an empty value clears that filter rather than applying an empty one, so the condition it addresses is dropped from the query. A bracket-indexed form of a declared parameter outside its own recognised sub-keys (`?<name>[0]=`, `?<name>[]=`) is rejected with a 422 rather than ignored."},"required":false,"name":"<parameter_name>","in":"query"},{"schema":{"type":"string","description":"Fills this report's user-definable `location.city` parameter slot, if the report's author declared one, with a comma-separated list of cities (values ORed, matching case-insensitive exact). Silently ignored, with no error and a 200 response, if the report declares no such slot or declares more than one (SPEC-DIR-20260909-directory-api-location-filters Decision 2.13), and which of the two is never disclosed. Cannot be combined with `suburb` (422 naming both), and cannot be combined with that slot's own `condition_id` query key in the same request (422 naming both)."},"required":false,"name":"city","in":"query"},{"schema":{"type":"string","description":"Alias for `city` (Australian addressing). Same rules as `city`. Cannot be combined with `city` in the same request (422 naming both)."},"required":false,"name":"suburb","in":"query"},{"schema":{"type":"string","description":"Fills this report's user-definable `location.state` parameter slot, if the report's author declared one, with a comma-separated list of states (values ORed, matching case-insensitive exact). Silently ignored, with no error and a 200 response, if the report declares no such slot or declares more than one. Cannot be combined with that slot's own `condition_id` query key in the same request (422 naming both)."},"required":false,"name":"state","in":"query"},{"schema":{"type":"string","description":"Fills this report's user-definable `location.postcode` parameter slot, if the report's author declared one, with a comma-separated list of postcodes (values ORed, matching case-insensitive exact). Silently ignored, with no error and a 200 response, if the report declares no such slot or declares more than one. Cannot be combined with that slot's own `condition_id` query key in the same request (422 naming both)."},"required":false,"name":"postcode","in":"query"},{"schema":{"type":"string","description":"Fills this report's user-definable `location.country` parameter slot, if the report's author declared one, with a comma-separated list of countries. Matching is exact against the stored value, which carries no normalisation. Silently ignored, with no error and a 200 response, if the report declares no such slot or declares more than one. Cannot be combined with that slot's own `condition_id` query key in the same request (422 naming both)."},"required":false,"name":"country","in":"query"}],"responses":{"200":{"description":"The report file. `text/csv` by default, or the XLSX content type when `format=xlsx`. When the report includes an item list custom field (SPEC-DIR-20260930-directory-item-list-field US-3.1), the CSV file holds that column as the listing's item count and nothing else, unless the report is an item list alone (below). A report saved before configured sheets existed also gains, in its XLSX file, one automatic worksheet per item list field, after the main sheet, named after the field and listing one row per item across every listing the report returned, each row repeating the listing name and the report's own columns (or the report's configured subset) before the item's own fields. A report created since then carries exactly its configured sheets, and no automatic sheet is added for an item list column. An items sheet holds at most 100,000 rows; a longer one ends with a row stating it was truncated. A cell the caller is not entitled to see keeps the report's `restricted_value_message` on the main sheet, and the workbook has no items sheet at all for a field the caller's audience may not see. A report whose author configured its sheets produces exactly those sheets, in the order configured after the main sheet, named and shaped by the author, for list and summary reports alike; a configured report with no extra sheets downloads the main sheet alone. A configured sheet is either an item list sheet or a further list or summary sheet of the same listings. An item list sheet lists every listing the report returned, one row per item, grouped by listing in listing name then slug order, with the author's chosen listing columns and item fields in order, and is omitted when the caller's audience may not see its item list field. A list or summary sheet covers every listing the report's filters return (with the same restricted-listing exclusion), shaped like the main sheet with its own columns, headings, formats, ranking, order and totals; the report's row limit and sort apply to the main sheet only, while each list or summary sheet keeps its own order and row limit (a list sheet its sort field and row limit, a summary sheet its group order and group limit), applied to what the caller may see: a value the caller is not entitled to see sorts last and never decides which rows a sheet keeps. Rows that tie on a list sheet's sort field, every row whose sort value is restricted or empty, and every row of a list sheet with no sort of its own, are listed by listing name then slug, never in the report's sort order. A sheet's own row limit is never reported as truncation; only the row cap is. A cell the caller is not entitled to see on a list or summary sheet keeps the report's `restricted_value_message`, and such a sheet is never omitted for that reason. A report can also be an item list alone: its main sheet then lists one row per item of one item list field, grouped by listing, with the author's chosen listing columns and item fields in order, and it downloads as CSV or XLSX alike. An item list that is denied to the caller on every listing leaves the header row and no item rows. An item list report that also configures extra sheets downloads as XLSX only. The main sheet can carry a tab name of its own; the downloaded file is still named after the report.","content":{"text/csv":{"schema":{"type":"string","format":"binary"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Unauthorized — missing/invalid API key, or an invalid/expired member bearer token when one was supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden. Either the account does not hold the directory.export_reports tenant feature (`FORBIDDEN`), or the report is published and in the caller's own account but the caller's own standing refuses it: `sign_in_required` (\"Sign in to download this report\"), `membership_required` (\"You do not have the required membership to download this report\"), or `entitlement_required` (\"You do not have the required entitlement to download this report\"). Each message is generic and never names the audience, the entitlement keys, or the segment ids. An unpublished, foreign-tenant, or nonexistent report is never refused this way: it returns the byte-identical 404 below, so this 403 discloses nothing about a report the caller could not already name.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/DirectoryExportReportDenial"},{"$ref":"#/components/schemas/ApiError"}]}}}},"404":{"description":"Export report not found — identical for unpublished, foreign-tenant, and nonexistent report ids","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"An undeclared report parameter, an unsupported `format` value, `city` and `suburb` supplied together, a named location parameter supplied together with that slot's own `condition_id` key, a bracket-indexed named location parameter (`?state[0]=`, `?state[]=`), a bracket-indexed report parameter outside its own recognised sub-keys (`?<name>[0]=`, `?<name>[]=`), or an explicit `format=csv` for a report whose author configured extra sheets, which downloads as Excel only: the error names `format` and asks for `format=xlsx`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me":{"get":{"summary":"Get the contact for the authenticated user","description":"Returns the CRM contact for the user identified by the bearer token within the API key's account. Requires both an API key (`X-API-Key`) and a Supabase user bearer token (`Authorization: Bearer <jwt>`). The user identity is derived exclusively from the token — explicit `user_id` parameters are not accepted.","tags":["Me"],"security":[{"apiKey":["crm.contacts.browse"],"userBearer":[]}],"responses":{"200":{"description":"Contact for the authenticated user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactMeResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"summary":"Update the authenticated user's contact","description":"Updates the CRM contact for the user identified by the bearer token. The target contact is resolved server-side from the bearer JWT; callers cannot update someone else's contact through this route. Requires the elevated `crm.contacts.manage` scope to confirm the key may act as a tenant member. The accepted body is narrower than `PATCH /v1/crm/contacts/{id}`: `status` and other staff-only lifecycle fields are not accepted on the self-service route. Use the admin route for those transitions.","tags":["Me"],"security":[{"apiKey":["crm.contacts.manage"],"userBearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string","minLength":1,"maxLength":200},"last_name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":50},"company":{"type":["string","null"],"maxLength":200},"job_title":{"type":["string","null"],"maxLength":200},"website":{"type":["string","null"],"maxLength":2048,"description":"The contact's own website. Must start with http:// or https:// (any other scheme is refused with 400) and be at most 2048 characters. An empty string or null clears it."},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":50},"custom_fields":{"type":"object","additionalProperties":{}}}}}}},"responses":{"200":{"description":"Contact updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyContactUpdated"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account, or the key lacks crm.contacts.manage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/team":{"get":{"summary":"List the corporate-membership team for the authenticated user","description":"Returns the team members visible to the caller via a corporate membership the caller either holds or sits on as a seat, together with the caller's own seat context as `self`. Returns an empty `members` array and a null `self` when the caller has no corporate membership. `self.seats_used` counts every seat row whatever its status plus live pending invitations, and `self.max_seats_effective` is the seats the membership was bought with (else the tier allowance) plus purchased extra seats: together they match the seat cap enforced when a seat is assigned. Identity is derived exclusively from the bearer token; no contact_id parameter is accepted.","tags":["Me"],"security":[{"apiKey":["crm.contacts.browse"],"userBearer":[]}],"responses":{"200":{"description":"Team members and the caller's own seat context for the authenticated user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyTeamResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The caller has no unique corporate membership (AMBIGUOUS_CORPORATE_MEMBERSHIP)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/team/invitations":{"post":{"summary":"Invite a new team member to the caller's corporate membership","description":"Reuses the existing contact for the supplied email when one already exists in the account, otherwise creates a fresh contact, then adds a corporate seat in `invited` status. Identity is derived exclusively from the bearer token; no contact_id parameter is accepted. Caller must hold the corporate membership directly or be an admin seat-holder.","tags":["Me"],"security":[{"apiKey":["crm.contacts.manage"],"userBearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteTeamMemberBody"}}}},"responses":{"201":{"description":"The newly invited team member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteTeamMemberResponse"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Caller has no corporate membership (NO_CORPORATE_MEMBERSHIP) or is not a team admin (NOT_TEAM_ADMIN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The contact is already a member of this team (ALREADY_TEAM_MEMBER), the membership seat cap has been reached (SEAT_CAP_EXCEEDED), the corporate membership is not in good standing (MEMBERSHIP_NOT_IN_GOOD_STANDING), or the caller has no unique corporate membership (AMBIGUOUS_CORPORATE_MEMBERSHIP)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"INVITE_EMAIL_NOT_CONFIGURED — the account has no admin sender address configured, so the invite email cannot be dispatched. Set the sender and click Resend.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/team/{id}":{"patch":{"summary":"Update a team member's role or status","description":"Update role and/or status on a team member's corporate seat. Identity is derived exclusively from the bearer token; caller must hold the corporate membership directly or be an admin seat-holder.","tags":["Me"],"security":[{"apiKey":["crm.contacts.manage"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTeamMemberBody"}}}},"responses":{"200":{"description":"The updated team member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTeamMemberResponse"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Caller has no corporate membership (NO_CORPORATE_MEMBERSHIP) or is not a team admin (NOT_TEAM_ADMIN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Team member not found in the caller's membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The caller has no unique corporate membership (AMBIGUOUS_CORPORATE_MEMBERSHIP)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"summary":"Remove a team member from the caller's corporate membership","description":"Deletes the corporate seat. The underlying contact record is preserved. Identity is derived exclusively from the bearer token; caller must hold the corporate membership directly or be an admin seat-holder.","tags":["Me"],"security":[{"apiKey":["crm.contacts.manage"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Team member removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoveTeamMemberResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Caller has no corporate membership or is not a team admin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Team member not found in the caller's membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The caller has no unique corporate membership (AMBIGUOUS_CORPORATE_MEMBERSHIP)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/team/{id}/resend-invite":{"post":{"summary":"Resend the invitation for an invited team member","description":"Reissues a pending invitation belonging to the caller's membership, revoking the previous token and attempting to email the replacement. Returns the committed outcome with email_sent and, if delivery fails, email_error_code; the replacement invitation remains pending. Use the returned invitation_id for any subsequent resend.","tags":["Me"],"security":[{"apiKey":["crm.contacts.manage"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Invitation reissued with its email delivery outcome","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendInviteResponse"}}}},"400":{"description":"Seat is not in invited status, cannot resend invitation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Caller has no corporate membership or is not a team admin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Team member not found in the caller's membership, or superseded by a later resend","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The corporate membership is not in good standing (MEMBERSHIP_NOT_IN_GOOD_STANDING), or the caller has no unique corporate membership (AMBIGUOUS_CORPORATE_MEMBERSHIP)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/cpd-exports":{"post":{"summary":"Record a CPD export event for the authenticated user","description":"Captures the audit trail when the portal exports the caller's Continuing Professional Development data. The portal generates the export client-side; this endpoint logs the action. Identity is derived exclusively from the bearer token.","tags":["Me"],"security":[{"apiKey":["crm.contacts.manage"],"userBearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogCpdExportBody"}}}},"responses":{"201":{"description":"The recorded CPD export log entry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogCpdExportResponse"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/transactions":{"get":{"summary":"List transactions for the authenticated user","description":"Returns the CRM orders attached to the caller's contact, ordered by `created_at` descending. Each row mirrors a `crm_orders` record: `order_number`, `order_type`, `status`, `payment_status`, the four `*_cents` totals, currency, optional description, optional metadata, `paid_at`, `created_at`, `updated_at`. Sourced from `crm_orders` (the source of truth for purchases); `crm_deals` is sales-pipeline only and is intentionally excluded. Identity is derived exclusively from the bearer token; no contact_id parameter is accepted. `total_cents` is the GST-inclusive amount paid, `tax_cents` the GST component contained within it, and `subtotal_cents` the net remainder; `discount_cents` is informational. An order cancelled automatically because its hosted card checkout expired unpaid (a membership join, an event registration or a corporate seats purchase the contact walked away from) is not returned, as in the member portal. An order staff cancelled is still returned with `status` `cancelled`.","tags":["Me"],"security":[{"apiKey":["crm.transactions.browse"],"userBearer":[]}],"responses":{"200":{"description":"Transactions for the authenticated user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyTransactionsResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/colleagues":{"get":{"summary":"List corporate-membership colleagues eligible for ticket transfer","description":"Returns the seat-mates on the caller's corporate membership. Sets `can_transfer: false` and an empty array when the caller has no corporate membership (e.g. individual-tier members). Identity is derived exclusively from the bearer token.","tags":["Me"],"security":[{"apiKey":["crm.contacts.browse"],"userBearer":[]}],"responses":{"200":{"description":"Caller's transferable colleagues","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferableColleaguesResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The caller has no unique corporate membership (AMBIGUOUS_CORPORATE_MEMBERSHIP)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/contacts/{id}/team":{"get":{"summary":"List a contact's corporate-membership team (admin view)","description":"Returns the team members under a specific contact's corporate membership. Admin-facing; caller specifies which contact to view and the gateway scope-gates with crm.contacts.browse. Returns an empty array when the contact has no corporate membership.","tags":["Contacts"],"security":[{"apiKey":["crm.contacts.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Team members under the contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactTeamResponse"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Contact not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"AMBIGUOUS_CORPORATE_MEMBERSHIP: the contact has more than one corporate membership, or active seats on more than one, and none is uniquely preferred in this account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/statements":{"post":{"summary":"Generate a statement PDF for a calendar or financial year","description":"Renders a PDF of the caller's transactions for a calendar year or the organisation's financial year, with period boundaries in the organisation's timezone. The PDF is uploaded to a private storage bucket and a 10-minute signed URL is returned. No caching at v1.0: each call produces a fresh file. An order cancelled automatically because its hosted card checkout expired unpaid (a membership join, an event registration or a corporate seats purchase the contact walked away from) is left off the statement and its totals, as in the member portal and `GET /v1/crm/me/transactions`. An order staff cancelled is still listed as Cancelled. Identity is derived exclusively from the bearer token.","tags":["Me"],"security":[{"apiKey":["crm.transactions.browse"],"userBearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateStatementBody"}}}},"responses":{"201":{"description":"Statement metadata with short-lived signed URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatementResponse"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/transactions/{id}/invoice":{"get":{"summary":"Get the hosted invoice URL for a transaction owned by the caller","description":"Resolves to the Stripe-hosted invoice page (or the stored PDF) for a transaction (CRM order) that belongs to the authenticated user. Identity is derived exclusively from the bearer token; cross-tenant access returns 404.","tags":["Me"],"security":[{"apiKey":["crm.transactions.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Hosted invoice URL for the transaction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceUrlResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Transaction not found (TRANSACTION_NOT_FOUND), or no invoice has been generated for the transaction yet (NO_INVOICE_AVAILABLE)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/connected-profile":{"get":{"summary":"Return the cross-app profile aggregate for the authenticated user","description":"Returns the contact plus directory, LMS, events, and activity subsections for the caller. Identity is derived exclusively from the bearer token; no contact_id parameter is accepted. LMS achievements are scoped to the API key's account — only badges, certificates, and CPD earned through enrollments in this tenant are returned. Each sub-section is fetched independently; a section that errors at the service layer surfaces as null without failing the whole response.","tags":["Me"],"security":[{"apiKey":["crm.contacts.browse"],"userBearer":[]}],"responses":{"200":{"description":"Cross-app profile aggregate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyConnectedProfileResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/contacts":{"get":{"operationId":"get_crm_contacts","summary":"List contacts","tags":["Contacts"],"security":[{"apiKey":["crm.contacts.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","maxLength":64},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"]},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"string","enum":["active","pending","lapsed","expired","cancelled","deceased"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":"string","maxLength":500},"required":false,"name":"tags","in":"query"},{"schema":{"type":["integer","null"],"minimum":0,"maximum":100},"required":false,"name":"engagementMin","in":"query"},{"schema":{"type":["integer","null"],"minimum":0,"maximum":100},"required":false,"name":"engagementMax","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"createdAfter","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"createdBefore","in":"query"}],"responses":{"200":{"description":"Paginated contact list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactListResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"create_crm_contact","summary":"Create a contact","tags":["Contacts"],"security":[{"apiKey":["crm.contacts.create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string","minLength":1,"maxLength":200},"last_name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":50},"company":{"type":["string","null"],"maxLength":200},"job_title":{"type":["string","null"],"maxLength":200},"website":{"type":["string","null"],"maxLength":2048,"description":"The contact's own website. Must start with http:// or https:// (any other scheme is refused with 400) and be at most 2048 characters. An empty string or null clears it."},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":50},"primary_company_id":{"type":["string","null"],"format":"uuid"},"custom_fields":{"type":"object","additionalProperties":{}},"external_source":{"type":"string","minLength":1,"maxLength":64},"external_id":{"type":"string","minLength":1,"maxLength":255}},"required":["first_name","last_name"]}}}},"responses":{"201":{"description":"Contact created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Contact"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Duplicate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/contacts/bulk":{"post":{"summary":"Bulk create / update / delete contacts (max 100 ops)","description":"Operations run sequentially; partial success is the normal case. A failure on one op does not abort the rest of the batch. Each operation is its own statement -- this endpoint is NOT a single database transaction. Per-operation outcomes are reported by index in the `results` array.","tags":["Contacts"],"security":[{"apiKey":["crm.contacts.manage"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkContactsRequest"}}}},"responses":{"200":{"description":"Per-operation results with success/failure counts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkContactsResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/contacts/search":{"get":{"operationId":"get_crm_contacts_search","summary":"Full-text search across contacts","description":"Searches the account's contacts by first name, last name, or email. Uses the `search_contacts` RPC where available and falls back to a sanitised ILIKE OR clause when the RPC is not present. Admin-facing; no bearer token required.","tags":["Contacts"],"security":[{"apiKey":["crm.contacts.browse"]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"excludeContactId","in":"query"}],"responses":{"200":{"description":"Matching contacts in relevance order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSearchResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/contacts/{id}":{"get":{"operationId":"get_crm_contacts_id","summary":"Get a contact by id","description":"Returns the contact with its structured addresses and the resolved billing and correspondence address ids. The list endpoint does not include addresses. Source-imported companies use verified external identities; an upstream ultimate-parent reference alone does not establish a direct parent relationship.","tags":["Contacts"],"security":[{"apiKey":["crm.contacts.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"boolean"},"required":false,"name":"includeDeletionImpact","in":"query"}],"responses":{"200":{"description":"Contact","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ContactDetail"}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"operationId":"update_crm_contact","summary":"Update a contact","description":"Either supply a user bearer token (`Authorization: Bearer <jwt>`) with the `crm.contacts.manage` scope on the key, OR call with the API key alone and the `crm.contacts.update` scope (unattended write).","tags":["Contacts"],"security":[{"apiKey":["crm.contacts.manage"],"userBearer":[]},{"apiKey":["crm.contacts.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string","minLength":1,"maxLength":200},"last_name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":50},"company":{"type":["string","null"],"maxLength":200},"job_title":{"type":["string","null"],"maxLength":200},"website":{"type":["string","null"],"maxLength":2048,"description":"The contact's own website. Must start with http:// or https:// (any other scheme is refused with 400) and be at most 2048 characters. An empty string or null clears it."},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":50},"primary_company_id":{"type":["string","null"],"format":"uuid"},"custom_fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["active","pending","lapsed","expired","cancelled"]}}}}}},"responses":{"200":{"description":"Contact updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Contact"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Bearer token was supplied but invalid or expired (INVALID_USER_TOKEN).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Bearer token absent and the API key lacks the granular 'crm.contacts.update' scope (MISSING_USER_OR_ELEVATED_SCOPE).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"operationId":"delete_crm_contact","summary":"Delete a contact","tags":["Contacts"],"security":[{"apiKey":["crm.contacts.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Contact deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteContactResponse"}}}},"204":{"description":"Legacy no-content response retained for generated-client compatibility; current routes return the documented 200 envelope"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Contact has linked records whose foreign key is RESTRICT or NO ACTION (for example deals or orders) and must be merged or retained; cascading and set-null references are applied on delete and never block (CONTACT_HAS_DEPENDENTS)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactHasDependentsError"}}}}}}},"/v1/crm/companies":{"get":{"operationId":"get_crm_companies","summary":"List companies","tags":["Companies"],"security":[{"apiKey":["crm.companies.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","maxLength":64},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"]},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"string","enum":["active","inactive","prospect","suspended","archived"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"classificationId","in":"query"},{"schema":{"type":"string","maxLength":100},"required":false,"name":"industry","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":["string","null"],"format":"uuid"},"required":false,"name":"parentCompanyId","in":"query"}],"responses":{"200":{"description":"Paginated company list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyListResponse"}}}}}},"post":{"operationId":"create_crm_company","summary":"Create a company","description":"The flat address fields (address_line_1 through country) write the company's Main address record: supplying any of them inserts it. parent_company_id must reference a live company in the same account; circular hierarchies are rejected with INVALID_INPUT (400).","tags":["Companies"],"security":[{"apiKey":["crm.companies.create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"legal_name":{"type":["string","null"],"maxLength":200},"display_name":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":5000},"classification_id":{"type":"string","format":"uuid"},"industry":{"type":["string","null"],"maxLength":100},"sub_industry":{"type":["string","null"],"maxLength":100},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":50},"website":{"type":["string","null"],"format":"uri"},"domain":{"type":["string","null"],"maxLength":200},"tax_id":{"type":["string","null"],"maxLength":50},"registration_number":{"type":["string","null"],"maxLength":50},"abn":{"type":["string","null"],"maxLength":20},"logo_url":{"type":["string","null"],"format":"uri"},"address_line_1":{"type":["string","null"],"maxLength":200,"description":"Reads and writes the company's Main address."},"address_line_2":{"type":["string","null"],"maxLength":200,"description":"Reads and writes the company's Main address."},"city":{"type":["string","null"],"maxLength":100,"description":"Reads and writes the company's Main address."},"state":{"type":["string","null"],"maxLength":100,"description":"Reads and writes the company's Main address."},"postcode":{"type":["string","null"],"maxLength":20,"description":"Reads and writes the company's Main address."},"country":{"type":["string","null"],"minLength":2,"maxLength":2,"description":"Reads and writes the company's Main address."},"parent_company_id":{"type":["string","null"],"format":"uuid"},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":50},"custom_fields":{"type":"object","additionalProperties":{}}},"required":["name"]}}}},"responses":{"201":{"description":"Company created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Company"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"The flat address fields could not be written because the 'Main' address type is not a usable company-applicable type for this organisation (ADDRESS_TYPE_NOT_USABLE).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/companies/{id}":{"get":{"operationId":"get_crm_companies_id","summary":"Get a company by id","description":"Returns the company with its structured addresses and the resolved billing and correspondence address ids. The list endpoint does not include addresses. Source-imported companies use verified external identities; an upstream ultimate-parent reference alone does not establish a direct parent relationship.","tags":["Companies"],"security":[{"apiKey":["crm.companies.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Company","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CompanyDetail"}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"operationId":"update_crm_company","summary":"Update a company","description":"The flat address fields (address_line_1 through country) read and write the company's Main address record: supplying any of them upserts it, supplying explicit null for all six removes it, and omitted fields leave it unchanged. parent_company_id must reference a live company in the same account and cannot create or join a circular hierarchy (INVALID_INPUT, 400). A parent_company_id equal to the stored value is accepted without re-validation. Set it to null to clear the parent.","tags":["Companies"],"security":[{"apiKey":["crm.companies.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"legal_name":{"type":["string","null"],"maxLength":200},"display_name":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":5000},"classification_id":{"type":"string","format":"uuid"},"industry":{"type":["string","null"],"maxLength":100},"sub_industry":{"type":["string","null"],"maxLength":100},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":50},"website":{"type":["string","null"],"format":"uri"},"domain":{"type":["string","null"],"maxLength":200},"tax_id":{"type":["string","null"],"maxLength":50},"registration_number":{"type":["string","null"],"maxLength":50},"abn":{"type":["string","null"],"maxLength":20},"logo_url":{"type":["string","null"],"format":"uri"},"address_line_1":{"type":["string","null"],"maxLength":200,"description":"Reads and writes the company's Main address."},"address_line_2":{"type":["string","null"],"maxLength":200,"description":"Reads and writes the company's Main address."},"city":{"type":["string","null"],"maxLength":100,"description":"Reads and writes the company's Main address."},"state":{"type":["string","null"],"maxLength":100,"description":"Reads and writes the company's Main address."},"postcode":{"type":["string","null"],"maxLength":20,"description":"Reads and writes the company's Main address."},"country":{"type":["string","null"],"minLength":2,"maxLength":2,"description":"Reads and writes the company's Main address."},"parent_company_id":{"type":["string","null"],"format":"uuid"},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":50},"custom_fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["active","inactive","prospect","suspended","archived"]},"lifecycle_stage":{"type":"string","enum":["lead","prospect","qualified","member","lapsed","former","suspended"]}}}}}},"responses":{"200":{"description":"Company updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Company"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"The flat address fields could not be written because the 'Main' address type is not a usable company-applicable type for this organisation (ADDRESS_TYPE_NOT_USABLE). The company field update is applied BEFORE the Main-address write, so a 422 does not mean nothing changed: any company fields in the same request have already been saved. Re-read the company to see its current state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"operationId":"delete_crm_company","summary":"Soft-delete a company","tags":["Companies"],"security":[{"apiKey":["crm.companies.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteCompanyResponse"}}}},"204":{"description":"Legacy no-content response retained for generated-client compatibility; current routes return the documented 200 envelope"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/fields":{"get":{"summary":"List public membership signup field definitions","description":"Returns the custom-field DEFINITIONS an association has marked for its public membership signup form (is_active AND display_on_signup), ordered by `sort_order` ascending then `created_at` ascending. That sequence is the order an administrator set, and it is contiguous and unambiguous within an entity type after any reorder (SPEC-CORE-20260728-custom-field-ordering). Definitions only: no stored member value is ever returned. Requires the crm.fields.browse scope.","tags":["Signup Fields"],"security":[{"apiKey":["crm.fields.browse"]}],"parameters":[{"schema":{"type":"string","enum":["contact","company"],"default":"contact"},"required":false,"name":"entityType","in":"query"}],"responses":{"200":{"description":"Signup field definitions","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/SignupField"}}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/tiers":{"get":{"operationId":"get_crm_tiers","summary":"List membership tiers","description":"Lists membership tiers for the account. Optional `tierType` query param (`individual` | `corporate` | `family`) restricts the result to that tier type; omit it to return all types.","tags":["Tiers"],"security":[{"apiKey":["crm.tiers.browse"]}],"parameters":[{"schema":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":false},"required":false,"name":"includeInactive","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":false},"required":false,"name":"includeMemberCounts","in":"query"},{"schema":{"type":"string","enum":["individual","corporate","family"]},"required":false,"name":"tierType","in":"query"}],"responses":{"200":{"description":"Tier list","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Tier"}}},"required":["success","data"]}}}}}},"post":{"operationId":"create_crm_tier","summary":"Create a tier","description":"Creates a membership tier. `reinstatement_policy` is optional and defaults to `current_period`. `grace_access` is optional and defaults to `keep`. A tier with `grace_access` `remove` and a recurring `billing_period` is refused with a 400 unless `grace_period_days` is shorter than the billing period (29 days for monthly, 89 quarterly, 364 annually, 729 biannually).","tags":["Tiers"],"security":[{"apiKey":["crm.tiers.create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[a-z0-9-]+$"},"description":{"type":"string","maxLength":2000},"tier_type":{"type":"string","enum":["individual","corporate","family"]},"max_seats":{"type":"integer","exclusiveMinimum":0},"price_cents":{"type":"integer","minimum":0},"billing_period":{"type":"string","enum":["monthly","quarterly","annually","biannually","lifetime"]},"renewal_basis":{"type":"string","enum":["anniversary","fixed_date"]},"fixed_renewal_month":{"type":"integer","minimum":1,"maximum":12},"fixed_renewal_day":{"type":"integer","minimum":1,"maximum":31},"proration_method":{"type":"string","enum":["none","daily","monthly","quarterly"]},"late_join_policy":{"type":"string","enum":["standard","full_fee_rollover","prorata_plus_next_period"],"description":"How a person joining late in an annual fixed-date period is charged on their first membership with the organisation. `standard` charges for the current period only. `full_fee_rollover` charges one full fee inside the late joining window and covers the following period. `prorata_plus_next_period` is reserved and currently rejected. Only annual tiers accept a policy other than `standard`."},"late_join_rollover_months":{"type":["integer","null"],"minimum":1,"maximum":11,"description":"The late joining window: months before a fixed-date renewal within which the late-join policy applies. Required, 1 to 11, when late_join_policy is not standard, and null when it is standard."},"grace_period_days":{"type":"integer","minimum":0,"maximum":365},"grace_access":{"type":"string","enum":["keep","remove"],"description":"Whether members keep access during the grace period. `keep` (the default) leaves access untouched until the grace period ends. `remove` removes everything a lapse removes from the paid-to date until the renewal is paid or staff restore access, and needs a `grace_period_days` shorter than a recurring `billing_period` (the request is otherwise refused). A change takes effect immediately."},"reinstatement_policy":{"type":"string","enum":["current_period","fresh_term"],"description":"Where the term of a returning member starts when they pay to rejoin after a lapse, expiry or cancellation. `current_period` (the default) keeps the member on their own renewal cycle and advances it past the payment date. `fresh_term` starts a new term from the payment date on an anniversary tier. A fixed-date tier always continues on its fixed renewal date, whatever this is set to."},"benefits":{"type":"array","items":{"type":"string","maxLength":500},"maxItems":50},"app_access":{"type":"object","additionalProperties":{"type":"string","enum":["full","limited","none"]}},"seat_pricing_mode":{"type":"string","enum":["fixed","graduated","volume"]},"seat_price_cents":{"type":["integer","null"],"minimum":0},"overflow_seat_price_cents":{"type":["integer","null"],"minimum":0},"included_seats":{"type":["integer","null"],"minimum":0},"currency":{"type":"string","enum":["AUD"]},"brackets":{"type":"array","items":{"type":"object","properties":{"bracket_order":{"type":"integer","minimum":1},"up_to_seats":{"type":["integer","null"],"minimum":1},"unit_price_cents":{"type":"integer","minimum":0}},"required":["bracket_order","up_to_seats","unit_price_cents"]},"maxItems":50}},"required":["name","tier_type"]}}}},"responses":{"201":{"description":"Tier created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Tier"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/tiers/{id}":{"get":{"operationId":"get_crm_tiers_id","summary":"Get a tier by id","tags":["Tiers"],"security":[{"apiKey":["crm.tiers.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Tier","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/TierDetail"}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"operationId":"update_crm_tier","summary":"Update a tier","description":"Updates a membership tier. A change to `reinstatement_policy` applies to rejoin payments made after the update; it never rewrites a membership already reinstated. A change to `grace_access` takes effect immediately. An update that leaves a tier with `grace_access` `remove` and a `grace_period_days` as long as its recurring `billing_period` is refused with a 400, whichever of the three fields the request carries (the limits are 29 days for monthly, 89 quarterly, 364 annually, 729 biannually). A tier already over the limit keeps its values until one of the three fields changes.","tags":["Tiers"],"security":[{"apiKey":["crm.tiers.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[a-z0-9-]+$"},"description":{"type":"string","maxLength":2000},"tier_type":{"type":"string","enum":["individual","corporate","family"]},"max_seats":{"type":"integer","exclusiveMinimum":0},"price_cents":{"type":"integer","minimum":0},"billing_period":{"type":"string","enum":["monthly","quarterly","annually","biannually","lifetime"]},"renewal_basis":{"type":"string","enum":["anniversary","fixed_date"]},"fixed_renewal_month":{"type":"integer","minimum":1,"maximum":12},"fixed_renewal_day":{"type":"integer","minimum":1,"maximum":31},"proration_method":{"type":"string","enum":["none","daily","monthly","quarterly"]},"late_join_policy":{"type":"string","enum":["standard","full_fee_rollover","prorata_plus_next_period"],"description":"How a person joining late in an annual fixed-date period is charged on their first membership with the organisation. `standard` charges for the current period only. `full_fee_rollover` charges one full fee inside the late joining window and covers the following period. `prorata_plus_next_period` is reserved and currently rejected. Only annual tiers accept a policy other than `standard`."},"late_join_rollover_months":{"type":["integer","null"],"minimum":1,"maximum":11,"description":"The late joining window: months before a fixed-date renewal within which the late-join policy applies. Required, 1 to 11, when late_join_policy is not standard, and null when it is standard."},"grace_period_days":{"type":"integer","minimum":0,"maximum":365},"grace_access":{"type":"string","enum":["keep","remove"],"description":"Whether members keep access during the grace period. `keep` (the default) leaves access untouched until the grace period ends. `remove` removes everything a lapse removes from the paid-to date until the renewal is paid or staff restore access, and needs a `grace_period_days` shorter than a recurring `billing_period` (the request is otherwise refused). A change takes effect immediately."},"reinstatement_policy":{"type":"string","enum":["current_period","fresh_term"],"description":"Where the term of a returning member starts when they pay to rejoin after a lapse, expiry or cancellation. `current_period` (the default) keeps the member on their own renewal cycle and advances it past the payment date. `fresh_term` starts a new term from the payment date on an anniversary tier. A fixed-date tier always continues on its fixed renewal date, whatever this is set to."},"benefits":{"type":"array","items":{"type":"string","maxLength":500},"maxItems":50},"app_access":{"type":"object","additionalProperties":{"type":"string","enum":["full","limited","none"]}},"is_active":{"type":"boolean"},"is_default":{"type":"boolean"},"sort_order":{"type":"integer","minimum":0},"seat_pricing_mode":{"type":"string","enum":["fixed","graduated","volume"]},"seat_price_cents":{"type":["integer","null"],"minimum":0},"overflow_seat_price_cents":{"type":["integer","null"],"minimum":0},"included_seats":{"type":["integer","null"],"minimum":0},"currency":{"type":"string","enum":["AUD"]},"brackets":{"type":"array","items":{"type":"object","properties":{"bracket_order":{"type":"integer","minimum":1},"up_to_seats":{"type":["integer","null"],"minimum":1},"unit_price_cents":{"type":"integer","minimum":0}},"required":["bracket_order","up_to_seats","unit_price_cents"]},"maxItems":50}}}}}},"responses":{"200":{"description":"Tier updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Tier"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"operationId":"delete_crm_tier","summary":"Delete a tier","tags":["Tiers"],"security":[{"apiKey":["crm.tiers.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteTierResponse"}}}},"204":{"description":"Legacy no-content response retained for generated-client compatibility; current routes return the documented 200 envelope"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Every membership reference blocks deletion, regardless of status (TIER_HAS_ACTIVE_MEMBERSHIPS)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/entitlements":{"get":{"summary":"The authenticated user's resolved member standing","description":"Returns the membership tier ids the caller currently holds in the API key's account, resolved through the single shared member definition: an active individual membership OR an active corporate seat on an active corporate membership, within each tier's grace period, honouring the tenant corporate-seat setting.\n\nUse this, not `GET /v1/crm/me/memberships`, to decide access. That route lists raw individual membership rows: it omits corporate seat holders and leaves grace-period arithmetic to you, so deciding access from it means reimplementing the member definition and getting a different answer from the rest of the platform.\n\nIdentity comes only from the bearer JWT; no contact, member or tier identifier is accepted. A user with no contact in the account is not an error: they hold nothing, which distinguishes \"signed in but not a member\" from \"not signed in\". Responses are per-caller and returned `Cache-Control: private, no-store`.","tags":["Me"],"security":[{"apiKey":["crm.memberships.browse"],"userBearer":[]}],"responses":{"200":{"description":"Resolved member standing for the authenticated user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyEntitlementsResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/memberships":{"get":{"summary":"List memberships for the authenticated user's contact","description":"Returns the memberships belonging to the CRM contact linked to the user identified by the bearer token, plus the corporate memberships the contact holds via an ACTIVE seat (`via_seat: true`; `contact_id` on those rows is the corporate holder's contact, not the caller). Identity is derived exclusively from the Supabase bearer JWT (`Authorization: Bearer <jwt>`) within the API key's account. No `contact_id` parameter is accepted.","tags":["Me"],"security":[{"apiKey":["crm.memberships.browse"],"userBearer":[]}],"responses":{"200":{"description":"Memberships for the authenticated user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyMembershipsResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"summary":"Purchase a membership for the authenticated user","description":"Composes the orders service: resolves the tier, inserts a pending `crm_orders` (`order_type=membership`) plus a `crm_order_items` row, then opens a checkout against that order. On a successful provider callback the cart fulfilment service marks the order paid and the membership handler creates the `crm_memberships` row, back-filling `crm_orders.membership_id`. Scope: `crm.memberships.purchase`. Bearer JWT required. Dues prices are GST-inclusive: the GST component is resolved from the tax regime and treatment rules of the organisation when the order is created and stored on it, so the amount charged at checkout is unchanged by tax. A contact who already holds an active membership on the tier is refused with `MEMBERSHIP_ALREADY_HELD` and no order, cart or checkout is created; the applicant should sign in to the member portal. This replaces the renewal checkout such a request was previously priced as, and renewing early is not available through this operation. Repeating the request while a checkout for the same contact and tier is open returns that checkout (the same `checkout_url`, `external_id` and `cart_id`, with `expires_at` as a UTC instant ending in `Z`) and creates no new order. The repeat must ask for the same `seats` as the open checkout; a different `seats` value is refused with `CHECKOUT_IN_PROGRESS` rather than answered with the first quote. The open checkout keeps the `success_url` and `cancel_url` it was created with. A checkout that has expired or closed is not open, so the request opens a new one, and the unpaid order it supersedes is cancelled. A contact whose membership on the tier has lapsed, expired or been cancelled, or who holds a different tier, is unaffected. A request made after a payment was received and before the membership is applied is refused with `CHECKOUT_IN_PROGRESS`.","tags":["Me"],"security":[{"apiKey":["crm.memberships.purchase"],"userBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tier_id":{"type":"string","format":"uuid"},"seats":{"type":"integer","exclusiveMinimum":0,"maximum":100,"description":"Seats to buy on a corporate tier, priced in the tier's seat pricing mode. At most the tier's `max_seats`, or 100 when it has none. When given, the new corporate membership records it as the seats bought, and its seat capacity becomes these seats plus any extra seats bought later in place of the tier's `max_seats`. Ignored on an individual tier."},"success_url":{"type":"string","format":"uri"},"cancel_url":{"type":"string","format":"uri"}},"required":["tier_id","success_url","cancel_url"]}}}},"responses":{"200":{"description":"Checkout session opened, or the checkout already open for this contact and tier","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CheckoutSession"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token (MISSING_USER_TOKEN, INVALID_USER_TOKEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account (NOT_ACCOUNT_MEMBER), or the sandbox has no active Stripe sandbox or eWay sandbox gateway (SANDBOX_PAYMENT_NOT_PERMITTED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Tier or contact not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"MEMBERSHIP_ALREADY_HELD: the contact already holds an active membership on this tier, so no checkout is opened. `error.details.portal_url` carries the organisation's member portal URL (see `MembershipAlreadyHeldDetails`), on its own domain when the organisation has an active one; the key is omitted if it cannot be resolved. Only this refusal carries it. CHECKOUT_IN_PROGRESS: a checkout for this contact and tier is already open or being created, a payment for it has been received and the membership is being activated, or a repeat asked for a different `seats` value than the open checkout; the applicant should complete it or let it expire, and a retry shortly after succeeds when it was only being created. CHECKOUT_RECOVERY_REQUIRED: the earlier checkout cannot be safely reopened and the applicant should contact the organisation. Retrying will not clear it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/memberships/purchase":{"post":{"summary":"Purchase a membership on behalf of a contact (unattended)","description":"Server-to-server companion to `POST /v1/crm/me/memberships`. The API key acts on behalf of the account and the buyer is named by `contact_id` in the body. Use the `/me/` route when a bearer token is available. Dues prices are GST-inclusive: the GST component is resolved from the tax regime and treatment rules of the organisation when the order is created and stored on it, so the amount charged at checkout is unchanged by tax. New-member pricing applies only to a contact's first membership with the organisation. On a fixed-date tier that contact pays for the part of the period that remains, or, under the tier's `full_fee_rollover` late-join policy, one full fee inside the late joining window covering the following period. A contact with a current membership buying a tier they have never held pays for the part of the period that remains, with no late-join policy. A contact whose membership on the tier is not active, for example cancelled but paid through a future date, and who pays on or before the renewal date plus the tier grace period is renewed by one billing period from the existing end date. Any other former member pays the full fee for the current period to the next renewal date, whatever the absence. Every order line carries a description naming the period bought and its end date. A contact who already holds an active membership on the tier is refused with `MEMBERSHIP_ALREADY_HELD` and no order, cart or checkout is created; the applicant should sign in to the member portal. This replaces the renewal checkout such a request was previously priced as, and renewing early is not available through this operation. Repeating the request while a checkout for the same contact and tier is open returns that checkout (the same `checkout_url`, `external_id` and `cart_id`, with `expires_at` as a UTC instant ending in `Z`) and creates no new order. The repeat must ask for the same `seats` as the open checkout; a different `seats` value is refused with `CHECKOUT_IN_PROGRESS` rather than answered with the first quote. The open checkout keeps the `success_url` and `cancel_url` it was created with. A checkout that has expired or closed is not open, so the request opens a new one, and the unpaid order it supersedes is cancelled. A contact whose membership on the tier has lapsed, expired or been cancelled, or who holds a different tier, is unaffected. A request made after a payment was received and before the membership is applied is refused with `CHECKOUT_IN_PROGRESS`.","tags":["Memberships"],"security":[{"apiKey":["crm.memberships.purchase"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":"string","format":"uuid"},"seats":{"type":"integer","exclusiveMinimum":0,"maximum":100,"description":"Seats to buy on a corporate tier, priced in the tier's seat pricing mode. At most the tier's `max_seats`, or 100 when it has none. When given, the new corporate membership records it as the seats bought, and its seat capacity becomes these seats plus any extra seats bought later in place of the tier's `max_seats`. Ignored on an individual tier."},"success_url":{"type":"string","format":"uri"},"cancel_url":{"type":"string","format":"uri"}},"required":["contact_id","tier_id","success_url","cancel_url"]}}}},"responses":{"200":{"description":"Checkout session opened, or the checkout already open for this contact and tier","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CheckoutSession"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scope, or the sandbox has no active Stripe sandbox or eWay sandbox gateway (SANDBOX_PAYMENT_NOT_PERMITTED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Tier or contact not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"MEMBERSHIP_ALREADY_HELD: the contact already holds an active membership on this tier, so no checkout is opened. `error.details.portal_url` carries the organisation's member portal URL (see `MembershipAlreadyHeldDetails`), on its own domain when the organisation has an active one; the key is omitted if it cannot be resolved. Only this refusal carries it. CHECKOUT_IN_PROGRESS: a checkout for this contact and tier is already open or being created, a payment for it has been received and the membership is being activated, or a repeat asked for a different `seats` value than the open checkout; the applicant should complete it or let it expire, and a retry shortly after succeeds when it was only being created. CHECKOUT_RECOVERY_REQUIRED: the earlier checkout cannot be safely reopened and the applicant should contact the organisation. Retrying will not clear it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/team/seats":{"post":{"summary":"Purchase corporate-membership seats","description":"Opens a checkout for additional corporate-membership seats. Two-mode write: bearer-attended callers hold `crm.seats.manage` and a valid bearer JWT (the buyer contact is resolved from the JWT user); unattended server-to-server callers hold `crm.seats.create` (the buyer is resolved from the named corporate membership owner). The body never carries a buyer-identity field. On checkout success the `corporate_seats` fulfilment handler inserts one `crm_corporate_seats` row per assignment. Seat prices are GST-inclusive: the GST component is resolved when the order is created and stored on it, so the amount charged at checkout is unchanged by tax.","tags":["Seats"],"security":[{"apiKey":["crm.seats.manage"],"userBearer":[]},{"apiKey":["crm.seats.create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"corporate_membership_id":{"type":"string","format":"uuid"},"seat_assignments":{"type":"array","items":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","member"]}},"required":["contact_id"]},"minItems":1,"maxItems":100},"success_url":{"type":"string","format":"uri"},"cancel_url":{"type":"string","format":"uri"}},"required":["corporate_membership_id","seat_assignments","success_url","cancel_url"]}}}},"responses":{"200":{"description":"Checkout session opened","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CheckoutSession"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or bearer supplied but invalid (INVALID_USER_TOKEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Bearer user is not a member of the API key's account (NOT_ACCOUNT_MEMBER), or bearer absent and the key lacks crm.seats.create (MISSING_USER_OR_ELEVATED_SCOPE), or the sandbox has no active Stripe sandbox or eWay sandbox gateway (SANDBOX_PAYMENT_NOT_PERMITTED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Corporate membership not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/team/seats/purchase":{"post":{"summary":"Purchase extra seats on the caller’s corporate membership","description":"Opens a checkout to increase `crm_memberships.extra_seats`. Bearer-attended only: the buyer contact and corporate membership are resolved from the JWT user’s seat context. The tier must have `overflow_seat_price_cents` configured, otherwise the request is rejected with TIER_PRICING_MISCONFIGURED. Scope: `crm.seats.manage`. Bearer JWT required. Overflow seat prices are GST-inclusive: the GST component is computed on the line total after any proration discount and stored on the order, so the amount charged at checkout is unchanged by tax.","tags":["Seats"],"security":[{"apiKey":["crm.seats.manage"],"userBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer","minimum":1,"maximum":50},"success_url":{"type":"string","format":"uri"},"cancel_url":{"type":"string","format":"uri"}},"required":["quantity","success_url","cancel_url"]}}}},"responses":{"200":{"description":"Checkout session opened","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CheckoutSession"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token (MISSING_USER_TOKEN, INVALID_USER_TOKEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account (NOT_ACCOUNT_MEMBER), or the sandbox has no active Stripe sandbox or eWay sandbox gateway (SANDBOX_PAYMENT_NOT_PERMITTED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Corporate membership or contact not found in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/memberships":{"get":{"operationId":"get_crm_memberships","summary":"List memberships for a contact","tags":["Memberships"],"security":[{"apiKey":["crm.memberships.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"contactId","in":"query"}],"responses":{"200":{"description":"Membership list","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Membership"}}},"required":["success","data"]}}}}}},"post":{"operationId":"assign_crm_membership","summary":"Assign a tier to a contact (create membership)","tags":["Memberships"],"security":[{"apiKey":["crm.memberships.create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"tier_id":{"type":"string","format":"uuid"},"start_date":{"type":"string","format":"date-time"}},"required":["contact_id","tier_id"]}}}},"responses":{"201":{"description":"Membership created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Membership"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/memberships/{id}":{"get":{"operationId":"get_crm_memberships_id","summary":"Get a membership by id","tags":["Memberships"],"security":[{"apiKey":["crm.memberships.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Membership","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Membership"}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"operationId":"update_crm_membership","summary":"Administratively update a membership","description":"Changes the tier, administrative status, or lifecycle dates without invoking checkout or renewal execution. Accepted statuses are active, pending, lapsed, and expired. The grace status is set only by the platform and is refused here. A membership in grace cannot be moved to active here, because that needs a hold date this endpoint does not set; the request is refused with a 400. It can be moved to lapsed or expired. Omitted fields remain unchanged.","tags":["Memberships"],"security":[{"apiKey":["crm.memberships.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tier_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","pending","lapsed","expired"]},"start_date":{"type":"string","format":"date-time"},"renewal_date":{"type":["string","null"],"format":"date-time"},"expiry_date":{"type":["string","null"],"format":"date-time"}}}}}},"responses":{"200":{"description":"Membership updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Membership"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"operationId":"cancel_crm_membership","summary":"Cancel/end a membership","tags":["Memberships"],"security":[{"apiKey":["crm.memberships.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"Cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelMembershipResponse"}}}},"204":{"description":"Legacy no-content response retained for generated-client compatibility; current routes return the documented 200 envelope"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/seats":{"get":{"summary":"List seats for a corporate membership","tags":["Seats"],"security":[{"apiKey":["crm.seats.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"membershipId","in":"query"}],"responses":{"200":{"description":"Seat list","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/CorporateSeat"}}},"required":["success","data"]}}}}}},"post":{"summary":"Assign a corporate seat","tags":["Seats"],"security":[{"apiKey":["crm.seats.create"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"membership_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","member"]},"status":{"type":"string","enum":["invited","active","disabled"]}},"required":["membership_id","contact_id"]}}}},"responses":{"201":{"description":"Seat assigned","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CorporateSeat"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Seat cap exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/seats/{id}":{"get":{"summary":"Get a seat by id","tags":["Seats"],"security":[{"apiKey":["crm.seats.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Seat","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CorporateSeat"}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"summary":"Update a seat (role or status)","tags":["Seats"],"security":[{"apiKey":["crm.seats.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["admin","member"]},"status":{"type":"string","enum":["invited","active","disabled"]}}}}}},"responses":{"200":{"description":"Seat updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CorporateSeat"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"summary":"Revoke a corporate seat","tags":["Seats"],"security":[{"apiKey":["crm.seats.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Revoked"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/deals":{"get":{"operationId":"get_crm_deals","summary":"List deals with optional filters and pagination","tags":["Deals"],"security":[{"apiKey":["crm.deals.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"pageSize","in":"query"},{"schema":{"type":"string"},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"]},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"string","description":"CSV of statuses: open,won,lost"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"stageId","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"contactId","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"tierId","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":"integer","minimum":0},"required":false,"name":"minValueCents","in":"query"},{"schema":{"type":"integer","minimum":0},"required":false,"name":"maxValueCents","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"createdAfter","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"createdBefore","in":"query"}],"responses":{"200":{"description":"Paginated deals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealsListResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"create_crm_deal","summary":"Create a deal","tags":["Deals"],"security":[{"apiKey":["crm.deals.create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealBody"}}}},"responses":{"201":{"description":"Newly created deal","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/leads":{"post":{"summary":"Capture an inbound marketing lead as a contact, deal and note","tags":["Deals"],"security":[{"apiKey":["crm.contacts.create","crm.deals.create"]},{"apiKey":["crm.contacts.create","crm.deals.manage"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundLeadBody"}}}},"responses":{"200":{"description":"Returning lead: existing open same-source deal reused, note added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundLeadReturningResponse"}}}},"201":{"description":"New lead: contact resolved, deal created in the Lead stage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundLeadResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/deals/{id}":{"get":{"operationId":"get_crm_deals_id","summary":"Get a deal by id","tags":["Deals"],"security":[{"apiKey":["crm.deals.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deal","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"operationId":"update_crm_deal","summary":"Update a deal","tags":["Deals"],"security":[{"apiKey":["crm.deals.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealBody"}}}},"responses":{"200":{"description":"Updated deal","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"summary":"Delete a deal","tags":["Deals"],"security":[{"apiKey":["crm.deals.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteDealResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/deals/bulk":{"post":{"summary":"Bulk create / update / delete deals (max 100 ops)","description":"Operations run sequentially with per-operation result reporting; failures do not abort the batch. Not a single database transaction. Requires crm.deals.create, crm.deals.update, and crm.deals.delete scopes.","tags":["Deals"],"security":[{"apiKey":["crm.deals.create","crm.deals.update","crm.deals.delete"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDealsRequest"}}}},"responses":{"200":{"description":"Per-operation results with success/failure counts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDealsResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/deals/{id}/close":{"post":{"summary":"Close a deal as won or lost","description":"Closes the deal with the given status, optionally recording a close reason and competitor. actual_close_date defaults to today on the server when omitted.","tags":["Deals"],"security":[{"apiKey":["crm.deals.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseDealBody"}}}},"responses":{"200":{"description":"Closed deal","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseDealResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/tasks":{"get":{"summary":"List CRM tasks with optional filters","tags":["Tasks"],"security":[{"apiKey":["crm.tasks.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"pageSize","in":"query"},{"schema":{"type":"string"},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"]},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"contactId","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"dealId","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"assignedTo","in":"query"},{"schema":{"type":"boolean"},"required":false,"name":"completed","in":"query"},{"schema":{"type":"string","enum":["low","medium","high","urgent"]},"required":false,"name":"priority","in":"query"},{"schema":{"type":"string","enum":["call","email","meeting","follow_up","review","demo","proposal","other"]},"required":false,"name":"taskType","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"dueBefore","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"dueAfter","in":"query"},{"schema":{"type":"string","format":"date"},"required":false,"name":"dueOnBefore","in":"query"},{"schema":{"type":"string","format":"date"},"required":false,"name":"dueOnAfter","in":"query"}],"responses":{"200":{"description":"Paginated tasks","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TasksListResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"summary":"Create a task","tags":["Tasks"],"security":[{"apiKey":["crm.tasks.create"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskBody"}}}},"responses":{"201":{"description":"Newly created task","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/tasks/{id}":{"get":{"summary":"Get a task by id","tags":["Tasks"],"security":[{"apiKey":["crm.tasks.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Task","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"summary":"Update a task","tags":["Tasks"],"security":[{"apiKey":["crm.tasks.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTaskBody"}}}},"responses":{"200":{"description":"Updated task","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTaskResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"summary":"Delete a task","tags":["Tasks"],"security":[{"apiKey":["crm.tasks.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteTaskResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/deals/{id}/activities":{"get":{"summary":"List the activity log for a deal","description":"Returns deal activities newest-first. System events (stage_change, won, lost, value_change, ...) are emitted internally; manual notes are added via the matching POST endpoint.","tags":["Deals"],"security":[{"apiKey":["crm.deals.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"pageSize","in":"query"}],"responses":{"200":{"description":"Paginated activity log","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealActivitiesListResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"summary":"Record a manual note activity on a deal","description":"Always produces activity_type: 'note'. System events (stage_change, won, lost, value_change, ...) are emitted internally by the relevant deal mutation endpoint, not via this route.","tags":["Deals"],"security":[{"apiKey":["crm.deals.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddDealNoteBody"}}}},"responses":{"201":{"description":"Newly created note activity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddDealNoteResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/deals/{id}/tasks":{"get":{"summary":"List tasks scoped to a deal","description":"Convenience over GET /v1/crm/tasks?dealId={id}. Returns 404 when the deal does not exist in the account.","tags":["Deals"],"security":[{"apiKey":["crm.tasks.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"pageSize","in":"query"},{"schema":{"type":"string"},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"]},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"boolean"},"required":false,"name":"completed","in":"query"},{"schema":{"type":"string","enum":["low","medium","high","urgent"]},"required":false,"name":"priority","in":"query"},{"schema":{"type":"string","enum":["call","email","meeting","follow_up","review","demo","proposal","other"]},"required":false,"name":"taskType","in":"query"}],"responses":{"200":{"description":"Paginated tasks for the deal","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealTasksListResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"summary":"Create a task anchored to a deal","description":"Convenience over POST /v1/crm/tasks. The deal id from the path overrides any deal_id in the body so the task is always anchored to the deal in the URL.","tags":["Deals"],"security":[{"apiKey":["crm.tasks.create"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskBody"}}}},"responses":{"201":{"description":"Newly created task","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealTaskResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/deals/{id}/move":{"post":{"operationId":"move_crm_deal","summary":"Move a deal to a different pipeline stage","tags":["Deals"],"security":[{"apiKey":["crm.deals.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveDealBody"}}}},"responses":{"200":{"description":"Moved deal","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveDealResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/dashboard":{"get":{"summary":"Aggregate pipeline stats for the account","description":"Returns counts and revenue aggregates over the deals table. Optional `startDate` and `endDate` constrain the population to deals created within the range; when omitted, all-time stats are returned. `win_rate` is a percentage (0-100).","tags":["Analytics"],"security":[{"apiKey":["crm.deals.browse"]}],"parameters":[{"schema":{"type":"string","format":"date-time"},"required":false,"name":"startDate","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"endDate","in":"query"}],"responses":{"200":{"description":"Pipeline stats","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineStatsResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/segments":{"get":{"summary":"List audience segments for the account","description":"Read-only at v1.0; segment CRUD is admin-managed in the dashboard. Supports an optional `search` query against name and description.","tags":["Segments"],"security":[{"apiKey":["crm.segments.browse"]}],"parameters":[{"schema":{"type":"string","maxLength":200},"required":false,"name":"search","in":"query"}],"responses":{"200":{"description":"Segments ordered by name","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentsListResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/segments/{id}":{"get":{"summary":"Get a segment by id","tags":["Segments"],"security":[{"apiKey":["crm.segments.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Segment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/segments/{id}/contacts":{"get":{"summary":"Return the contacts matched by a segment's filter criteria","description":"Applies the segment's `filter_criteria` (status, tags, engagement range) against the contacts table and returns paginated matches. Unknown filter keys are dropped; malformed values are coerced or ignored so portal-defined segments don't break the endpoint.","tags":["Segments"],"security":[{"apiKey":["crm.segments.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"pageSize","in":"query"},{"schema":{"type":"string"},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"]},"required":false,"name":"sortOrder","in":"query"}],"responses":{"200":{"description":"Paginated contacts matched by the segment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentContactsResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/stages":{"get":{"operationId":"get_crm_stages","summary":"List deal pipeline stages for the account","description":"Returns the stages used to bucket deals on the pipeline. Read-only for v1.0; CRUD on stages is not exposed via the gateway. Pass `includeInactive=true` to include disabled stages.","tags":["Configuration"],"security":[{"apiKey":["crm.deals.browse"]}],"parameters":[{"schema":{"type":"boolean"},"required":false,"name":"includeInactive","in":"query"}],"responses":{"200":{"description":"Stages in sort_order ascending","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StagesResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/types":{"get":{"summary":"List deal classification types for the account","description":"Returns the deal type taxonomy (membership, event-registration, training-course, sponsorship, ...). Read-only for v1.0. Pass `includeInactive=true` to include disabled types.","tags":["Configuration"],"security":[{"apiKey":["crm.deals.browse"]}],"parameters":[{"schema":{"type":"boolean"},"required":false,"name":"includeInactive","in":"query"}],"responses":{"200":{"description":"Deal types in sort_order ascending","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealTypesResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/orders":{"post":{"summary":"Admin: issue a pending order for a member to pay","description":"Creates a pending `crm_orders` row plus its `crm_order_items`. The owning contact then pays via `POST /v1/crm/me/orders/{id}/pay`. A card checkout the contact opens and leaves unpaid never cancels an order issued this way: it stays pending and payable until staff cancel it. Two-mode: bearer-attended requires `crm.orders.manage`; unattended requires `crm.orders.create`. Order money is a net, tax, gross triple: `total_cents` is the GST-inclusive amount the contact will pay, `tax_cents` is the GST component contained within it, and `subtotal_cents` is the net remainder, so `subtotal_cents` plus `tax_cents` equals `total_cents` for any discount. `discount_cents` is informational and is not a term in the triple. Tax is always computed from the organisation regime and treatment rules. A supplied line `tax_cents` is only an assertion: a mismatch returns TAX_AMOUNT_MISMATCH and creates no order. Each persisted line also carries a supply classification (taxable, GST-free or input-taxed) stamped at creation time. It is neither accepted on the request nor returned on the response, so a caller can never assert the tax basis of a supply.","tags":["Orders"],"security":[{"apiKey":["crm.orders.manage"],"userBearer":[]},{"apiKey":["crm.orders.create"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contact_id":{"type":"string","format":"uuid"},"order_type":{"type":"string","enum":["membership","renewal","one_time","product","event","course"],"default":"one_time"},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/OrderLineItemInput"},"minItems":1,"maxItems":100},"description":{"type":"string","maxLength":2000},"metadata":{"type":"object","additionalProperties":{}}},"required":["contact_id","line_items"]}}}},"responses":{"201":{"description":"Order created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Order"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scope or user is not in the API key account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Contact not found in account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/me/orders/{id}/pay":{"post":{"summary":"Pay an unpaid order belonging to the authenticated contact","description":"Opens a checkout session against a pending `crm_orders` row that belongs to the JWT user. Scope: `crm.orders.pay`. Bearer JWT required. Company-debtor orders cannot be paid by the holding contact and return 409 ORDER_NOT_PAYABLE. For an accepted cart invoice, the amount is its current `outstanding_cents`; completion records a receipt against the original order and does not create or fulfil a second sale. Other orders charge their GST-inclusive `total_cents`. Tax is a component of either amount and is never added at checkout. `crm.order.paid` is emitted only when the resulting financial state is paid.","tags":["Orders"],"security":[{"apiKey":["crm.orders.pay"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"success_url":{"type":"string","format":"uri"},"cancel_url":{"type":"string","format":"uri"}},"required":["success_url","cancel_url"]}}}},"responses":{"200":{"description":"Checkout session opened","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CheckoutSession"}},"required":["success","data"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing/invalid API key or bearer token (MISSING_USER_TOKEN, INVALID_USER_TOKEN)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Bearer user is not a member of the API key account (NOT_ACCOUNT_MEMBER), or the sandbox has no active Stripe sandbox or eWay sandbox gateway or holds a stored checkout that is no longer permitted (SANDBOX_PAYMENT_NOT_PERMITTED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Order not found for the authenticated contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"ORDER_ALREADY_PAID: the order is already settled. ORDER_NOT_PAYABLE: the order has a company debtor, the invoice has no outstanding balance, requires review, or was cancelled. An order raised by a membership join, an event registration or a corporate seats purchase is cancelled automatically once its hosted checkout expires unpaid, so paying it returns ORDER_NOT_PAYABLE and the contact starts the purchase again. CHECKOUT_IN_PROGRESS: another request is creating a checkout for this order right now; retry shortly. CHECKOUT_RECOVERY_REQUIRED: a previous attempt left the provider state unknown, so no new checkout may be created until an operator confirms no live provider session exists. Retrying will not clear it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/team/invitations/{token}":{"get":{"summary":"Preview a corporate-seat invitation by raw token","description":"Returns a redacted preview of the invitation so the portal can render its `/invite/:token` landing page BEFORE the visitor signs in. The route is API-key-only; no bearer JWT is required. The preview reveals only the host company, tier name, role, invitee email, and expiry — nothing tenant-internal is exposed.","tags":["Me"],"security":[{"apiKey":["crm.invitations.verify"]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"token","in":"path"}],"responses":{"200":{"description":"Invitation preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationPreviewResponse"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"INVITATION_NOT_FOUND — token does not exist for this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/team/invitations/{token}/accept":{"post":{"summary":"Accept a corporate-seat invitation as the authenticated caller","description":"Binds the bearer JWT user to the seat referenced by the token and flips the seat status to `active`. Identity-bound policy: the caller must hold the raw token AND be signed in as the invited email; a mismatch is rejected with INVITATION_EMAIL_MISMATCH (403) so a leaked or forwarded token cannot be redeemed by a different identity. Rejects with CONTACT_ALREADY_LINKED when the contact is already bound to a different auth user in this account.","tags":["Me"],"security":[{"apiKey":["crm.invitations.accept"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"token","in":"path"}],"responses":{"200":{"description":"Invitation accepted; seat is now active","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInvitationResponse"}}}},"400":{"description":"INVITATION_EXPIRED — token has expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"INVITATION_EMAIL_MISMATCH — the authenticated caller email does not match the invitee email","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"INVITATION_NOT_FOUND — token does not exist for this account, or a later invitation to the same person replaced it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"INVITATION_ALREADY_ACCEPTED, INVITATION_REVOKED, MEMBERSHIP_NOT_IN_GOOD_STANDING (the corporate membership has lapsed, been cancelled or passed expiry plus grace), or CONTACT_ALREADY_LINKED (seat contact already bound to a different user)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/tiers/resolve-legacy":{"post":{"tags":["Tiers"],"summary":"Resolve legacy plan restrictions to Agend policies","description":"Maps a batch of legacy membership restrictions onto Agend access policies, for content migration. Requires `crm.tiers.browse`.\\n\\nReads nothing but the tier catalogue and writes nothing. It is a POST because it takes a batch body: a migration run must judge every restriction against the SAME catalogue, which per-item requests could not guarantee.\\n\\nMatching is on provenance only, the `external_source` and `external_id` recorded when each tier was imported. Names, slugs and prices are never used, so a plan renamed on one side is not silently joined to an unrelated one.\\n\\nUncertainty NEVER resolves to a policy. Exactly one match maps; several matches return `manual_review` with reason `ambiguous`; none returns `manual_review` with reason `unmatched`. Both review outcomes name every candidate considered.\\n\\nProvenance itself is never returned. It is deliberately absent from `/v1/crm/tiers`, which is publicly readable, so exposing it would publish the tenant's external plan ids.","security":[{"apiKey":["crm.tiers.browse"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","minLength":1,"maxLength":64},"restrictions":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["plan"]},"external_id":{"type":"string","maxLength":255}},"required":["kind","external_id"]},{"type":"object","properties":{"kind":{"type":"string","enum":["any_member"]}},"required":["kind"]}]},"minItems":1,"maxItems":500}},"required":["source","restrictions"]}}}},"responses":{"200":{"description":"One mapping outcome per submitted restriction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmLegacyPlanMappingListResponse"}}}}}}},"/v1/crm/me/segments":{"get":{"tags":["Me"],"summary":"Segments the calling member belongs to","description":"Returns the segments the bearer member currently belongs to. Requires `crm.segments.browse` and a member bearer token.\n\nThe counterpart to `/v1/crm/segments/{id}/contacts`, which answers the opposite question. A consumer needing a boolean for ONE visitor would otherwise have to fetch a whole member list and search it, placing every other member's contact record wherever that consumer runs.\n\nIdentity comes only from the bearer. A user with no contact in the account belongs to no segments, which is a normal answer rather than an error.\n\nNever cacheable in a shared store: the answer is entirely about who is asking, and it follows contact attributes that change as a member is edited.","security":[{"apiKey":["crm.segments.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string"},"required":true,"name":"authorization","in":"header"}],"responses":{"200":{"description":"Segments the caller belongs to","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmMemberSegmentListResponse"}}}}}}},"/v1/crm/entitlements/types":{"get":{"tags":["Entitlements"],"summary":"List the account's entitlement types","description":"Returns the account's entitlement type catalogue: every active benefit that has a `gate_key`, which is what content can be restricted by. Requires `crm.entitlements.browse`. It is an administrator-catalogue read authorised by the API key alone: no user bearer token is read or needed, and it says nothing about which members hold a type.\n\nA benefit with no `gate_key` (display-only) or that is inactive is not listed. Ordered by the catalogue display order (`sort_order`), then `name`.\n\nThe whole catalogue is returned in one response with no pagination: an account holds a few hundred types at most in practice, and an editor picker needs all of them. Add `search` to narrow it.\n\n`kind` says how the `gate_key` resolves. `platform-gate` is a code-owned platform capability (for example `directory.access`), so a picker can label it apart from a type an association or integration owns. `entitlement` is a key in the reserved `entitlement.` namespace. `unrecognised` is any other key; an integration declares its own `<category>.<type>` keys this way, and a non-null `managed_by_source_id` tells those apart from a stray key. `kind` is resolved by the platform registry: do not infer it from a prefix.","security":[{"apiKey":["crm.entitlements.browse"]}],"parameters":[{"schema":{"type":"string","maxLength":200,"description":"Case-insensitive substring of the type name or its `gate_key`, matched literally (so `_` and `%` are ordinary characters). At most 200 characters."},"required":false,"description":"Case-insensitive substring of the type name or its `gate_key`, matched literally (so `_` and `%` are ordinary characters). At most 200 characters.","name":"search","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"The entitlement types, in display order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmEntitlementTypeCatalogueResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The API key lacks the `crm.entitlements.browse` scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Entitlements"],"summary":"Declare the entitlement types a source manages","description":"Ensures a benefit catalogue entry for each submitted entitlement type, keyed on `gate_key`, so an integration has something for its grants to reference. Requires `crm.entitlements.sync`.\n\nThis is NOT general benefit CRUD. It cannot delete, deactivate, reorder or re-key a benefit, and it never touches tier assignment: a sync key should be able to declare what it grants without being able to reshape the association's catalogue.\n\n`gate_key` is lowercase alphanumeric with dots or underscores, 3 to 64 characters (for example `web_personalisation.premium_directory`). Hyphens and slashes are rejected: the key is shared with a code-owned capability registry and one lexical shape holds across both.\n\nAn existing entry matched on `gate_key` has only its name and description updated, and is never duplicated. Declaring a key that an administrator created by hand does NOT claim it: `managed_by_source_id` stays null so their own catalogue entry does not silently become read-only in the CRM.\n\nAt most 200 entries per request. A larger catalogue must be chunked by the client; the request is rejected rather than truncated, so entitlements cannot be lost silently. `gate_key` must also be unique within the request — a repeated key is rejected rather than silently processed twice.\n\nA `gate_key` that is a registered platform capability gate (the code-owned `MEMBER_GATES` registry, e.g. `lms.certifications`) is refused for the whole request, so a tenant integration cannot attach platform-feature meaning to an entitlement the platform never granted. A `gate_key` in the reserved `entitlement.` namespace, or any other format-valid key that is not registered, is accepted as before.\n\nIdempotent: repeating an identical request reports every entry as `existing` and writes nothing.","security":[{"apiKey":["crm.entitlements.sync"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmEntitlementTypeSyncRequest"}}}},"responses":{"200":{"description":"The ensured entitlement types, with a per-entry status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmEntitlementTypeSyncResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/crm/entitlements/grants":{"post":{"tags":["Entitlements"],"summary":"Reconcile a member's entitlements for one source","description":"Brings one member's entitlements for ONE source into line with that source's current truth. Requires `crm.entitlements.sync`.\n\nFull state for the named source, never a delta: what you send is what the member holds from you afterwards. An entitlement you previously granted and now omit is revoked, so a missed webhook corrects itself on the next call.\n\nCritically, this NEVER touches a grant owned by another source. A grant made by staff in the CRM, or arriving from a different integration, is not revoked, not modified, and not reported as a conflict. Send an empty `entries` array to revoke everything YOUR source grants while leaving those alone.\n\nIdentify the member with `contact_id`, OR with `external_source` and `external_id` together — never both, the request is rejected if you supply contact_id alongside an external identity pair. Resolution for an external identity pair runs in four steps: (1) `contact_id`, when supplied; (2) a contact already carrying this exact `external_source`/`external_id` pair; (3) failing that, the contact bound to the account's own SSO identity for this `external_id` — the member's SAML or WordPress login may have already resolved them to a contact under a different `external_source`; (4) failing that too, a contact matched by exact (case-insensitive) `email`, when `email` is supplied and that contact is not yet linked to a user. Steps 3 and 4 stamp this pair onto the matched contact when it has none yet, so later pushes take the faster step-2 path; a contact already holding a different pair is left untouched. An email match against more than one contact is rejected rather than guessed. An email match against a contact already linked to a user is not attached to: shared mailboxes are common in membership data, so a separate contact is created and the nightly duplicate detection surfaces the pair for manual review. Only when none of the four resolves is a contact created, which needs `first_name` and `last_name`; those are ignored when the contact already exists, so a sync cannot rewrite a member's name through this endpoint.\n\nAt most 200 entries per request, rejected rather than truncated.\n\nIdempotent: repeating an identical call reports every entitlement as `unchanged`, writes nothing, and adds no audit record.","security":[{"apiKey":["crm.entitlements.sync"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmEntitlementGrantReconcileRequest"}}}},"responses":{"200":{"description":"What changed: granted, refreshed, unchanged and revoked entitlement keys","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmEntitlementGrantReconcileResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events":{"get":{"tags":["Events"],"summary":"List events","description":"Retrieve a paginated list of published events with optional filtering by timeframe, date range, and search query. Members-only events remain discoverable. Callers without an entitled member bearer receive a teaser with protected details, pricing and tickets omitted, plus an `event_url` linking to the Agend event page. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: when valid, each item is enriched with `viewer_price_group` (the caller's resolved price group) and `my_registration` (their own non-cancelled registration for that event, or null); an invalid bearer is rejected. Identity is carried only by the validated JWT, never a parameter. Each event includes its canonical subject topics. Requires the events.events.browse scope in both modes.","security":[{"apiKey":["events.events.browse"]},{"apiKey":["events.events.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (1-indexed)"},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Results per page (1-100)"},"required":false,"name":"perPage","in":"query"},{"schema":{"type":"string","format":"date-time","description":"ISO 8601 datetime: return events starting after this date"},"required":false,"name":"startAfter","in":"query"},{"schema":{"type":"string","format":"date-time","description":"ISO 8601 datetime: return events starting before this date. Combined with startAfter, selects events starting between the two dates."},"required":false,"name":"startBefore","in":"query"},{"schema":{"type":"string","format":"date-time","description":"ISO 8601 datetime: return events ending before this date"},"required":false,"name":"endBefore","in":"query"},{"schema":{"type":"string","enum":["upcoming","past","all"],"description":"Timeframe relative to server time. 'upcoming': events ending at or after now (includes in-progress), ordered soonest-first. 'past': events ended before now, ordered most-recent-first. 'all': no timeframe filter, newest-first. Combines with startAfter/endBefore."},"required":false,"name":"timeframe","in":"query"},{"schema":{"type":"string","description":"Full-text search on event name"},"required":false,"name":"search","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Filter to events mapped to this category id"},"required":false,"name":"category","in":"query"},{"schema":{"type":"string","enum":["physical","virtual","hybrid"],"description":"Filter by event format / venue type (physical, virtual, hybrid)"},"required":false,"name":"type","in":"query"},{"schema":{"type":"string","description":"Filter by venue city (case-insensitive exact match)"},"required":false,"name":"city","in":"query"},{"schema":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Multi-select: repeatable category ids. Returns events mapped to ANY listed category. Takes precedence over `category`."},"required":false,"name":"categories","in":"query"},{"schema":{"type":"array","items":{"type":"string","enum":["physical","virtual","hybrid"]},"description":"Multi-select: repeatable venue types. Returns events matching ANY listed type. Takes precedence over `type`."},"required":false,"name":"types","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"Multi-select: repeatable venue cities. Returns events in ANY listed city. Takes precedence over `city`."},"required":false,"name":"cities","in":"query"},{"schema":{"type":"string","enum":["any","all"],"description":"How multiple `categories` combine. 'any' (default): events in ANY selected category. 'all': events in EVERY selected category."},"required":false,"name":"categoriesMatch","in":"query"},{"schema":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Editor exclusion scope: repeatable category ids to exclude. Events mapped to any listed category are removed from the result set."},"required":false,"name":"excludeCategories","in":"query"},{"schema":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Editor exclusion scope: repeatable tag ids to exclude."},"required":false,"name":"excludeTags","in":"query"},{"schema":{"type":"array","items":{"type":"string","enum":["physical","virtual","hybrid"]},"description":"Editor exclusion scope: repeatable venue types to exclude."},"required":false,"name":"excludeVenueTypes","in":"query"},{"schema":{"type":"array","items":{"type":"string"},"description":"Editor exclusion scope: repeatable venue cities to exclude."},"required":false,"name":"excludeCities","in":"query"},{"schema":{"type":"string","enum":["any","all"],"description":"How multiple `excludeCategories` combine. 'any' (default): exclude events in ANY excluded category. 'all': exclude only events in EVERY excluded category."},"required":false,"name":"excludeCategoriesMatch","in":"query"},{"schema":{"type":["boolean","null"],"description":"If true, include active tickets and pricing tiers on each event"},"required":false,"name":"includeTickets","in":"query"},{"schema":{"type":"string","description":"Comma-separated list of relations to eager-load on each event. Accepted values: categories, speakers, sponsors, waitlist. Example: include=categories,waitlist"},"required":false,"name":"include","in":"query"}],"responses":{"200":{"description":"Events retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/EventListItem"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Events"],"summary":"Create an event","description":"Create a new event owned by the calling account. The `account_id` is derived from the API key and may not be supplied in the body. Every id in `category_ids` must be a category, and every id in `tag_ids` a tag, of the calling account; an unknown id and another account's id are refused with the same 400. Requires `events.events.create` scope.","security":[{"apiKey":["events.events.create"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEventInput"}}}},"responses":{"201":{"description":"Event created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Event"}},"required":["success","data"]}}}},"400":{"description":"Validation failed, or `category_ids` or `tag_ids` contains an id that is not a category or tag of the calling account (`VALIDATION_ERROR`; unknown and foreign ids are indistinguishable). Nothing is written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/{slug}":{"get":{"tags":["Events"],"summary":"Get event by slug","description":"Retrieve details for a specific event by its URL slug. A caller without an entitled member bearer receives a teaser for a members-only event with protected details, pricing and tickets omitted, plus an `event_url` linking to the Agend event page. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: when valid, the response is enriched with `viewer_price_group` (the caller's resolved price group) and `my_registration` (their own non-cancelled registration for this event, or null); an invalid bearer is rejected. Identity is carried only by the validated JWT, never a parameter. Requires the events.events.browse scope in both modes.","security":[{"apiKey":["events.events.browse"]},{"apiKey":["events.events.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Event URL slug"},"required":true,"name":"slug","in":"path"},{"schema":{"type":["boolean","null"],"description":"If true, include active tickets and pricing tiers on the event"},"required":false,"name":"includeTickets","in":"query"},{"schema":{"type":"string","description":"Comma-separated list of relations to eager-load. Accepted values: categories, speakers, sponsors. Example: include=categories,speakers"},"required":false,"name":"include","in":"query"}],"responses":{"200":{"description":"Event retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"cpd_points":{"type":"integer","minimum":0,"maximum":999},"default_cpd_category_id":{"type":["string","null"],"format":"uuid"},"default_cpd_type_id":{"type":["string","null"],"format":"uuid"},"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"published_at":{"type":["string","null"],"format":"date-time"},"status":{"type":"string"},"hero_image_url":{"type":["string","null"]},"gallery_images":{"type":["array","null"],"items":{"type":"string"}},"meta_title":{"type":["string","null"]},"meta_description":{"type":["string","null"]},"custom_fields":{"type":["object","null"],"additionalProperties":{}},"external_source":{"type":["string","null"]},"external_id":{"type":["string","null"]},"external_url":{"type":["string","null"]},"description":{"type":["string","null"]},"short_description":{"type":["string","null"]},"venue_type":{"type":"string"},"venue_name":{"type":["string","null"]},"venue_address":{"type":["string","null"]},"venue_city":{"type":["string","null"]},"venue_state":{"type":["string","null"]},"venue_postcode":{"type":["string","null"]},"venue_country":{"type":["string","null"]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"virtual_url":{"type":["string","null"]},"all_day":{"type":"boolean"},"registration_required":{"type":"boolean"},"member_only":{"type":"boolean"},"purchase_start_at":{"type":["string","null"],"format":"date-time"},"purchase_end_at":{"type":["string","null"],"format":"date-time"},"start_date":{"type":"string","format":"date-time"},"end_date":{"type":"string","format":"date-time"},"timezone":{"type":"string"},"capacity":{"type":["integer","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"topics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"canonical_topic_id":{"type":["string","null"],"format":"uuid"}},"required":["id","name","slug","canonical_topic_id"]}},"viewer_price_group":{"type":"string","enum":["member","non_member","corporate"],"description":"Optional-identity enrichment (Decision 2.10): present when the caller supplies a valid member bearer token — the viewer's price group resolved from their contact and active memberships with the organiser account. Absent for anonymous callers."},"my_registration":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"anyOf":[{"type":"string","enum":["pending","pending_payment","confirmed","cancelled","attended","no_show","reserved","expired"]},{"type":"string"}],"description":"Reserved places await invoice payment and expired places have been released. Neither is an admission credential. Existing status strings remain accepted."},"attendance_status":{"type":"string","enum":["attended","no_show","not_checked_in"]},"ticket_id":{"type":"string","format":"uuid"}},"required":["id","status","attendance_status","ticket_id"],"description":"Optional-identity enrichment (Decision 2.10): present when the caller supplies a valid member bearer token — the viewer's own non-cancelled registration for this event, or null when they have none. Absent for anonymous callers."},"teaser":{"type":"object","properties":{"access":{"type":"string","enum":["member_only"]},"event_url":{"type":"string","format":"uri"}},"required":["access","event_url"],"description":"Present when the caller may discover a members-only event but may not access its protected details or tickets."},"tickets":{"type":"array","items":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"is_active":{"type":"boolean"},"allocation":{"type":"integer"},"sold_count":{"type":"integer"}},"required":["id","name","is_active","allocation","sold_count"]},"pricingTiers":{"type":"array","items":{"type":"object","properties":{"tier":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"start_at":{"type":["string","null"],"format":"date-time"},"end_at":{"type":["string","null"],"format":"date-time"},"member_price":{"type":["number","null"],"description":"Member price. GST-inclusive amount the buyer pays. Tax is carved out of this figure when the order is created, never added to it at checkout."},"non_member_price":{"type":["number","null"],"description":"Non-member price. GST-inclusive amount the buyer pays. Tax is carved out of this figure when the order is created, never added to it at checkout."},"corporate_price":{"type":["number","null"],"description":"Corporate price. GST-inclusive amount the buyer pays. Tax is carved out of this figure when the order is created, never added to it at checkout."}},"required":["id","name","start_at","end_at","member_price","non_member_price","corporate_price"]},"isActive":{"type":"boolean"}},"required":["tier","isActive"]}},"capacityRemaining":{"type":"integer"}},"required":["ticket","pricingTiers","capacityRemaining"]}},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"sort_order":{"type":"integer"}},"required":["id","name","slug","description","sort_order"]}},"speakers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"title":{"type":["string","null"]},"bio":{"type":["string","null"]},"photo_url":{"type":["string","null"]},"sort_order":{"type":"integer"}},"required":["id","name","title","bio","photo_url","sort_order"]}},"sponsors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"tier":{"type":"string"},"logo_url":{"type":["string","null"]},"website":{"type":["string","null"]},"sort_order":{"type":"integer"}},"required":["id","name","tier","logo_url","website","sort_order"]}},"waitlist":{"type":"object","properties":{"has_waitlist":{"type":"boolean"},"is_available":{"type":"boolean"},"waiting_count":{"type":"integer"}},"required":["has_waitlist","is_available","waiting_count"]}},"required":["cpd_points","default_cpd_category_id","default_cpd_type_id","id","account_id","name","slug","published_at","status","hero_image_url","gallery_images","meta_title","meta_description","custom_fields","external_source","external_id","external_url","description","short_description","venue_type","venue_name","venue_address","venue_city","venue_state","venue_postcode","venue_country","latitude","longitude","virtual_url","all_day","registration_required","member_only","purchase_start_at","purchase_end_at","start_date","end_date","timezone","capacity","created_at","updated_at","topics"]}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Event not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["Events"],"summary":"Update an event","description":"Edit an event by slug. Optional `category_ids` and `tag_ids` arrays replace the existing associations. Every id in `category_ids` must be a category, and every id in `tag_ids` a tag, of the calling account; an unknown id and another account's id are refused with the same 400, before anything is written. Cross-tenant access returns 404. Requires `events.events.update` scope.\n\nSet `X-Agend-Suppress-Webhooks: true` (requires `webhooks.suppress` scope) when applying a change received from another system to avoid emitting `events.event.updated` and creating a sync loop. Suppression is account-wide — every subscriber on the account misses the event.","security":[{"apiKey":["events.events.update"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","enum":["true","false","1","0","yes","no"],"description":"Set to `true` to skip webhook emission on this CUD call (anti-loop opt-out for sync integrations). Requires the API key to hold the `webhooks.suppress` scope; otherwise the request fails with 403 INSUFFICIENT_SCOPES. Suppression is account-wide for this single request — every subscriber misses the event."},"required":false,"name":"x-agend-suppress-webhooks","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEventInput"}}}},"responses":{"200":{"description":"Event updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Event"}},"required":["success","data"]}}}},"400":{"description":"`category_ids` or `tag_ids` contains an id that is not a category or tag of the calling account (`VALIDATION_ERROR`; unknown and foreign ids are indistinguishable). The event is not changed and no `events.event.updated` webhook is emitted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"X-Agend-Suppress-Webhooks was set but the API key lacks the webhooks.suppress scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Event not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Events"],"summary":"Delete an event","description":"Soft-delete an event by slug. Sets `deleted_at` so reads filtering `deleted_at IS NULL` no longer return the row. Requires `events.events.delete` scope.\n\nSet `X-Agend-Suppress-Webhooks: true` (requires `webhooks.suppress` scope) to avoid emitting `events.event.deleted`. See the PATCH variant for details.","security":[{"apiKey":["events.events.delete"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","enum":["true","false","1","0","yes","no"],"description":"Set to `true` to skip webhook emission on this CUD call (anti-loop opt-out for sync integrations). Requires the API key to hold the `webhooks.suppress` scope; otherwise the request fails with 403 INSUFFICIENT_SCOPES. Suppression is account-wide for this single request — every subscriber misses the event."},"required":false,"name":"x-agend-suppress-webhooks","in":"header"}],"responses":{"200":{"description":"Event deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventDeletedResult"}},"required":["success","data"]}}}},"403":{"description":"X-Agend-Suppress-Webhooks was set but the API key lacks the webhooks.suppress scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Event not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/{slug}/tickets":{"get":{"tags":["Events"],"summary":"Get event tickets with pricing","description":"Retrieve all ticket types for an event, including pricing tiers and availability.","security":[{"apiKey":["events.tickets.browse"]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Event URL slug"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"boolean","description":"If true, return all pricing tiers (including inactive) with an isActive flag. Defaults to false (active tiers only)."},"required":false,"name":"allPricePoints","in":"query"}],"responses":{"200":{"description":"Event tickets retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/TicketEntry"}}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Event not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Events"],"summary":"Create a ticket for an event","description":"Add a new ticket type to an event. Account ownership of the parent event is verified server-side. Requires `events.tickets.create` scope.","security":[{"apiKey":["events.tickets.create"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTicketInput"}}}},"responses":{"201":{"description":"Ticket created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventTicket"}},"required":["success","data"]}}}},"404":{"description":"Event not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/categories":{"get":{"tags":["Events"],"summary":"List event categories","description":"Retrieve all available event categories for the account.","security":[{"apiKey":["events.categories.browse"]}],"responses":{"200":{"description":"Event categories retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/EventCategory"}}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Events"],"summary":"Create an event category","description":"Create a category for organising events. Optional `parentId` builds a hierarchy. Slug is auto-generated from name when omitted. Requires `events.categories.create` scope.","security":[{"apiKey":["events.categories.create"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEventCategoryInput"}}}},"responses":{"201":{"description":"Category created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventCategory"}},"required":["success","data"]}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/venues":{"get":{"tags":["Events"],"summary":"List event venues","description":"Retrieve all available event venues for the account.","security":[{"apiKey":["events.venues.browse"]}],"parameters":[{"schema":{"type":"boolean","description":"If true, only return active (non-archived) venues"},"required":false,"name":"onlyActive","in":"query"}],"responses":{"200":{"description":"Event venues retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/EventVenue"}}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Events"],"summary":"Create a venue","description":"Create a reusable venue record for the calling account. Requires `events.venues.create` scope.","security":[{"apiKey":["events.venues.create"]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateVenueInput"}}}},"responses":{"201":{"description":"Venue created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventVenue"}},"required":["success","data"]}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/{slug}/register":{"post":{"tags":["Events"],"summary":"Register one or more attendees for an event ticket","description":"Creates one `event_registrations` row per entry in `beneficiaries[]`. All registrations share the same `ticket_id`. Returns `{ registrations: RegistrationResult[] }` in input order on success. On partial failure (a later beneficiary errors after earlier ones succeeded) the response is 400 with `registrations` (the rows already created) plus `failed_beneficiaries[]` (`{ index, reason }`) so the caller can decide whether to retry the remainder or cancel the partial set. Member-aware pricing (SPEC-CORE-20260722 US-2.1 AC3): when the buyer is resolved from a validated identity — a session cookie or a member bearer token (`Authorization: Bearer <jwt>`) — the request body's `price_group` is IGNORED and the server resolves it from the buyer's contact and active memberships with the organiser account instead. The guest-buyer (`buyer` field) and unattended (per-beneficiary `crm_contact_id`) contracts are unchanged and keep the client-supplied `price_group`. A members-only event accepts a registration only from a member bearer whose contact holds a current membership with the organiser account; every other caller, including the guest-buyer and unattended contracts, receives 400 `MEMBER_ONLY`.","security":[{"apiKey":["events.registrations.create"]},{"apiKey":["events.registrations.create"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Event URL slug"},"required":true,"name":"slug","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ticket_id":{"type":"string","format":"uuid","description":"Ticket to register the beneficiaries against. Optional: future interest-style registration flows may omit it. The current registration service requires it and returns 400 when missing."},"price_group":{"type":"string","enum":["member","non_member","corporate"],"default":"non_member","description":"Pricing tier to apply"},"beneficiaries":{"type":"array","items":{"$ref":"#/components/schemas/EventBeneficiary"},"minItems":1,"maxItems":50,"description":"One entry per attendee. Length determines how many `event_registrations` rows are created."}},"required":["beneficiaries"]}}}},"responses":{"201":{"description":"Registrations created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventRegisterResponse"}},"required":["success","data"]}}}},"400":{"description":"Validation error, invalid request, a `beneficiary_contact_id` on a guest registration (`VALIDATION_ERROR`, with `details.fields` naming `beneficiaries.<index>.beneficiary_contact_id`; checked before any contact, cart or registration is created), `MEMBER_ONLY` (a members-only event without an entitled member bearer), or partial-success (some beneficiaries created, others failed; see `details.registrations` and `details.failed_beneficiaries`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Event or ticket not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Conflict (e.g., ticket capacity full)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations":{"get":{"tags":["Events"],"summary":"List registrations","description":"List all registrations for the account with optional filtering.","security":[{"apiKey":["events.registrations.browse"]}],"parameters":[{"schema":{"type":"string","description":"Filter by event slug"},"required":false,"name":"eventSlug","in":"query"},{"schema":{"type":"string","description":"Filter by registration status (pending, confirmed, pending_payment, cancelled, attended, no_show, reserved, expired). Reserved places await invoice payment; expired places are released. Neither grants admission."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","description":"Search by beneficiary name or email"},"required":false,"name":"search","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Filter by CRM contact ID (purchaser)"},"required":false,"name":"crmContactId","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (1-indexed)"},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50,"description":"Results per page (1-100)"},"required":false,"name":"perPage","in":"query"}],"responses":{"200":{"description":"Registrations retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/RegistrationManagement"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations/pay":{"post":{"tags":["Events"],"summary":"Pay for one or more pending event registrations","description":"Composes the orders + registration-payment services. Given a set of pending registration ids owned by the calling contact, inserts a pending `crm_orders` row + line items, back-fills `event_registrations.order_id`, and opens a checkout session. On a successful provider callback the cart fulfilment service marks the order paid and the event-registration handler confirms each registration. Ticket prices are GST-inclusive, so each order line carries the GST component carved out of the registration price rather than added to it: the amount charged is the price the buyer was shown, and the order `tax_cents` is the GST contained within it. Scope: `events.registrations.pay`. Legacy callers use an API key plus Supabase user bearer; mobile callers use the ordinary bearer plus an organisation-scoped mobile session. Identity is taken exclusively from the validated credentials, never a parameter.","security":[{"apiKey":["events.registrations.pay"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"registration_ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":50},"success_url":{"type":"string","format":"uri"},"cancel_url":{"type":"string","format":"uri"}},"required":["registration_ids","success_url","cancel_url"]}}}},"responses":{"200":{"description":"Checkout session opened","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CheckoutSession"}},"required":["success","data"]}}}},"400":{"description":"Validation error or REGISTRATIONS_ALL_FREE (nothing to pay)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The sandbox has no active Stripe sandbox or eWay sandbox gateway (SANDBOX_PAYMENT_NOT_PERMITTED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"One or more registrations were not found or do not belong to the calling contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"One or more registrations are already paid or linked to an order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations/{id}":{"get":{"tags":["Events"],"summary":"Get registration","description":"Get a single registration by ID, scoped to the account.","security":[{"apiKey":["events.registrations.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Registration ID"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Registration retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/RegistrationManagement"}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Registration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Events"],"summary":"Cancel registration","description":"Cancel a registration. Optionally supply a cancellation reason.","security":[{"apiKey":["events.registrations.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Registration ID"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","description":"Reason for cancellation"}}}}}},"responses":{"200":{"description":"Registration cancelled successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/RegistrationManagement"}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Registration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Registration is already cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["Events"],"summary":"Update a registration attendee","description":"Update a registration’s attendee identity (beneficiary_type/name/email/contact) and per-event registration_data after purchase (SPEC-CORE-20260721-event-attendee-capture, Decision 2.9). Distinct from the RSVP route: this changes WHO the ticket is for, not attending/dietary/notes. Either supply a user bearer token (`Authorization: Bearer <jwt>`) with the `events.registrations.manage` scope on the key (the purchaser or organiser staff path), OR call with the API key alone and the `events.registrations.update` scope (unattended, server-to-server write). No edit cut-off applies.","security":[{"apiKey":["events.registrations.manage"],"userBearer":[]},{"apiKey":["events.registrations.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Registration ID"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"beneficiary_type":{"type":"string","enum":["self","named","unnamed"]},"beneficiary_name":{"type":"string","minLength":1,"maxLength":255},"beneficiary_email":{"type":"string","format":"email"},"beneficiary_contact_id":{"type":"string","format":"uuid"},"registration_data":{"type":"object","additionalProperties":{}}}}}}},"responses":{"200":{"description":"Registration attendee updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/RegistrationAttendee"}},"required":["success","data"]}}}},"400":{"description":"Validation error (schema rejection or invalid custom field values)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Bearer present but not a member of the account, or bearer absent and the key lacks the unattended scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Registration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The new attendee name and email duplicate another named registration on the same ticket","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations/{id}/check-in":{"patch":{"tags":["Events"],"summary":"Check in registration","description":"Confirm attendance and atomically record the eligible event CPD award. Retried confirmations preserve the original attendance and award. Financial refunds do not undo attendance.","security":[{"apiKey":["events.registrations.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Registration ID"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Registration checked in successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event_id":{"type":"string","format":"uuid"},"ticket_id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"status":{"anyOf":[{"type":"string","enum":["pending","pending_payment","confirmed","cancelled","attended","no_show","reserved","expired"]},{"type":"string"}],"description":"Reserved places await invoice payment and expired places have been released. Neither is an admission credential. Existing status strings remain accepted."},"payment_status":{"type":["string","null"]},"beneficiary_type":{"type":["string","null"]},"beneficiary_name":{"type":["string","null"]},"beneficiary_email":{"type":["string","null"]},"beneficiary_user_id":{"type":["string","null"],"format":"uuid"},"crm_contact_id":{"type":["string","null"],"format":"uuid"},"beneficiary_id":{"type":["string","null"],"format":"uuid"},"booked_by":{"type":["string","null"],"format":"uuid"},"price_group":{"type":["string","null"]},"final_price":{"type":["number","null"],"description":"GST-inclusive amount charged for this registration. Tax is a component of this figure, carved out when the order is created, never added at checkout."},"registered_at":{"type":"string","format":"date-time"},"cancelled_at":{"type":["string","null"],"format":"date-time"},"cancelled_reason":{"type":["string","null"]},"checked_in_at":{"type":["string","null"],"format":"date-time"},"checked_in_by":{"type":["string","null"],"format":"uuid"},"cpd":{"type":"object","properties":{"unit_label":{"type":"string"},"status":{"type":"string","enum":["awarded","already_awarded","not_eligible","reversed","retained","preview"]},"reason":{"type":["string","null"]},"activity_id":{"type":["string","null"],"format":"uuid"},"points":{"type":["number","null"]},"requires_identity_confirmation":{"type":"boolean"},"preview_token":{"type":["string","null"]},"preview":{"type":["object","null"],"properties":{"member_id":{"type":["string","null"],"format":"uuid"},"member_name":{"type":["string","null"]},"category_name":{"type":["string","null"]},"type_name":{"type":["string","null"]},"activity_name":{"type":"string"},"date_completed":{"type":"string"},"points":{"type":"number"},"category_id":{"type":["string","null"],"format":"uuid"},"type_id":{"type":["string","null"],"format":"uuid"}},"required":["member_id","member_name","category_name","type_name","activity_name","date_completed","points","category_id","type_id"]}},"required":["unit_label","status","reason","activity_id","points","requires_identity_confirmation","preview_token","preview"]}},"required":["id","event_id","ticket_id","account_id","status","payment_status","beneficiary_type","beneficiary_name","beneficiary_email","beneficiary_user_id","crm_contact_id","beneficiary_id","booked_by","price_group","final_price","registered_at","cancelled_at","cancelled_reason","checked_in_at","checked_in_by","cpd"]}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Registration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Attendance requires reconciliation or cannot be confirmed in its current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations/{id}/undo-attendance":{"post":{"tags":["Events"],"summary":"Undo attendance with an audit reason","security":[{"apiKey":["events.registrations.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":1000}},"required":["reason"]}}}},"responses":{"200":{"description":"Attendance CPD outcome","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"registration_id":{"type":"string","format":"uuid"},"event_id":{"type":"string","format":"uuid"},"transitioned":{"type":"boolean"},"cpd":{"type":"object","properties":{"unit_label":{"type":"string"},"status":{"type":"string","enum":["awarded","already_awarded","not_eligible","reversed","retained","preview"]},"reason":{"type":["string","null"]},"activity_id":{"type":["string","null"],"format":"uuid"},"points":{"type":["number","null"]},"requires_identity_confirmation":{"type":"boolean"},"preview_token":{"type":["string","null"]},"preview":{"type":["object","null"],"properties":{"member_id":{"type":["string","null"],"format":"uuid"},"member_name":{"type":["string","null"]},"category_name":{"type":["string","null"]},"type_name":{"type":["string","null"]},"activity_name":{"type":"string"},"date_completed":{"type":"string"},"points":{"type":"number"},"category_id":{"type":["string","null"],"format":"uuid"},"type_id":{"type":["string","null"],"format":"uuid"}},"required":["member_id","member_name","category_name","type_name","activity_name","date_completed","points","category_id","type_id"]}},"required":["unit_label","status","reason","activity_id","points","requires_identity_confirmation","preview_token","preview"]}},"required":["registration_id","event_id","transitioned","cpd"]}},"required":["success","data"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Stale preview or conflicting attendance state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations/{id}/reconcile-cpd":{"post":{"tags":["Events"],"summary":"Confirm a previewed attendance CPD reconciliation","security":[{"apiKey":["events.registrations.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirm_identity":{"type":"boolean","default":false},"expected_preview_token":{"type":"string","minLength":1}},"required":["expected_preview_token"]}}}},"responses":{"200":{"description":"Attendance CPD outcome","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"registration_id":{"type":"string","format":"uuid"},"event_id":{"type":"string","format":"uuid"},"transitioned":{"type":"boolean"},"cpd":{"type":"object","properties":{"unit_label":{"type":"string"},"status":{"type":"string","enum":["awarded","already_awarded","not_eligible","reversed","retained","preview"]},"reason":{"type":["string","null"]},"activity_id":{"type":["string","null"],"format":"uuid"},"points":{"type":["number","null"]},"requires_identity_confirmation":{"type":"boolean"},"preview_token":{"type":["string","null"]},"preview":{"type":["object","null"],"properties":{"member_id":{"type":["string","null"],"format":"uuid"},"member_name":{"type":["string","null"]},"category_name":{"type":["string","null"]},"type_name":{"type":["string","null"]},"activity_name":{"type":"string"},"date_completed":{"type":"string"},"points":{"type":"number"},"category_id":{"type":["string","null"],"format":"uuid"},"type_id":{"type":["string","null"],"format":"uuid"}},"required":["member_id","member_name","category_name","type_name","activity_name","date_completed","points","category_id","type_id"]}},"required":["unit_label","status","reason","activity_id","points","requires_identity_confirmation","preview_token","preview"]}},"required":["registration_id","event_id","transitioned","cpd"]}},"required":["success","data"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Stale preview or conflicting attendance state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"get":{"tags":["Events"],"summary":"Preview attendance CPD reconciliation","security":[{"apiKey":["events.registrations.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Attendance CPD outcome","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"registration_id":{"type":"string","format":"uuid"},"event_id":{"type":"string","format":"uuid"},"transitioned":{"type":"boolean"},"cpd":{"type":"object","properties":{"unit_label":{"type":"string"},"status":{"type":"string","enum":["awarded","already_awarded","not_eligible","reversed","retained","preview"]},"reason":{"type":["string","null"]},"activity_id":{"type":["string","null"],"format":"uuid"},"points":{"type":["number","null"]},"requires_identity_confirmation":{"type":"boolean"},"preview_token":{"type":["string","null"]},"preview":{"type":["object","null"],"properties":{"member_id":{"type":["string","null"],"format":"uuid"},"member_name":{"type":["string","null"]},"category_name":{"type":["string","null"]},"type_name":{"type":["string","null"]},"activity_name":{"type":"string"},"date_completed":{"type":"string"},"points":{"type":"number"},"category_id":{"type":["string","null"],"format":"uuid"},"type_id":{"type":["string","null"],"format":"uuid"}},"required":["member_id","member_name","category_name","type_name","activity_name","date_completed","points","category_id","type_id"]}},"required":["unit_label","status","reason","activity_id","points","requires_identity_confirmation","preview_token","preview"]}},"required":["registration_id","event_id","transitioned","cpd"]}},"required":["success","data"]}}}},"403":{"description":"Not permitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Stale preview or conflicting attendance state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations/{id}/no-show":{"patch":{"tags":["Events"],"summary":"Mark no-show","description":"Mark a confirmed registration as a no-show. Repeating the call on a registration that is already a no-show succeeds. Any other registration status is refused with 409 `REGISTRATION_STATUS_CONFLICT`, or 409 `REGISTRATION_INVOICE_HOLD` for a reserved or expired invoice hold.","security":[{"apiKey":["events.registrations.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Registration ID"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Registration marked as no-show","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/RegistrationManagement"}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Registration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The registration is not confirmed (`REGISTRATION_STATUS_CONFLICT`) or is an invoice hold (`REGISTRATION_INVOICE_HOLD`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations/my-tickets":{"get":{"tags":["Events"],"summary":"My tickets (as beneficiary)","description":"Returns event registrations where the calling CRM contact is the beneficiary (the actual attendee). Cancelled registrations are excluded. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: when valid, the beneficiary contact is derived from the bearer and `crmContactId` is not required (and never overrides the bearer). Without a bearer, `crmContactId` is required.","security":[{"apiKey":["events.registrations.browse"]},{"apiKey":["events.registrations.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"CRM contact ID. Required only when no member bearer token is supplied — with a bearer, the beneficiary contact is derived from `auth.context.userId` and this value is ignored (SPEC-CORE-20260722 US-2.1 AC4)."},"required":false,"name":"crmContactId","in":"query"},{"schema":{"type":"string","enum":["future","current","past"],"description":"future: events not yet started, current: in progress, past: already ended"},"required":false,"name":"timeframe","in":"query"},{"schema":{"type":"string","enum":["attended","no_show","not_checked_in"],"description":"Filter by attendance status"},"required":false,"name":"attendanceStatus","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (1-indexed)"},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Results per page (1-100)"},"required":false,"name":"perPage","in":"query"}],"responses":{"200":{"description":"Tickets retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/MyTicketEntry"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations/my-purchases":{"get":{"tags":["Events"],"summary":"My purchases (as purchaser)","description":"Returns event registrations where the given CRM contact is the purchaser. Cancelled registrations are excluded.","security":[{"apiKey":["events.registrations.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"CRM contact ID (required)"},"required":true,"name":"crmContactId","in":"query"},{"schema":{"type":"string","enum":["future","current","past"],"description":"future: events not yet started, current: in progress, past: already ended"},"required":false,"name":"timeframe","in":"query"},{"schema":{"type":"string","enum":["attended","no_show","not_checked_in"],"description":"Filter by attendance status"},"required":false,"name":"attendanceStatus","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (1-indexed)"},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Results per page (1-100)"},"required":false,"name":"perPage","in":"query"}],"responses":{"200":{"description":"Purchases retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/MyTicketEntry"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/{slug}/waitlist":{"post":{"tags":["Events"],"summary":"Join event waitlist","description":"Add the caller to the waitlist for a specific event ticket. Requires the events.waitlist.create scope. A members-only event accepts a waitlist entry only when an optional member bearer token (`Authorization: Bearer <jwt>`) resolves to a contact holding a current membership with the organiser account; every other caller receives 400 `MEMBER_ONLY`.","security":[{"apiKey":["events.waitlist.create"]},{"apiKey":["events.waitlist.create"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Event URL slug"},"required":true,"name":"slug","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ticket_id":{"type":"string","format":"uuid","description":"Ticket ID to join the waitlist for"},"attendee_name":{"type":"string","minLength":1,"maxLength":200,"description":"Name of the attendee"},"attendee_email":{"type":"string","format":"email","description":"Email of the attendee"}},"required":["ticket_id","attendee_name","attendee_email"]}}}},"responses":{"201":{"description":"Waitlist entry created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventWaitlistJoinResult"}},"required":["success","data"]}}}},"400":{"description":"Invalid request, event not waitlistable, or `MEMBER_ONLY` (a members-only event without an entitled member bearer)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Already on waitlist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/waitlist/{id}":{"delete":{"tags":["Events"],"summary":"Leave waitlist","description":"Remove a waiting or reserved waitlist entry. An entry that is already converted, expired or removed is refused with 409 `WAITLIST_ENTRY_SETTLED`.","security":[{"apiKey":["events.waitlist.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Waitlist entry ID"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Removed from waitlist","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventWaitlistLeaveResult"}},"required":["success","data"]}}}},"400":{"description":"Missing or invalid ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Waitlist entry not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The entry is already converted, expired or removed (`WAITLIST_ENTRY_SETTLED`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/waitlist":{"get":{"tags":["Events"],"summary":"Get waitlist entries for a CRM contact","description":"Returns waitlist entries for a CRM contact. When no event filter is provided, returns all active entries (waiting or reserved) for future events. Pass event_id or event_slug to retrieve the single entry for a specific event.","security":[{"apiKey":["events.waitlist.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"CRM contact UUID"},"required":true,"name":"contact_id","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Filter to a specific event by UUID"},"required":false,"name":"event_id","in":"query"},{"schema":{"type":"string","description":"Filter to a specific event by slug"},"required":false,"name":"event_slug","in":"query"}],"responses":{"200":{"description":"Array of waitlist entries when no event filter is supplied; single entry object when event_id or event_slug is supplied.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event_id":{"type":"string","format":"uuid"},"ticket_id":{"type":"string","format":"uuid"},"position":{"type":"integer"},"status":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"event":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"start_date":{"type":"string","format":"date-time"},"end_date":{"type":"string","format":"date-time"}},"required":["id","name","slug","start_date","end_date"]}},"required":["id","event_id","ticket_id","position","status","created_at","event"]}},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event_id":{"type":"string","format":"uuid"},"ticket_id":{"type":"string","format":"uuid"},"position":{"type":"integer"},"status":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"event":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"start_date":{"type":"string","format":"date-time"},"end_date":{"type":"string","format":"date-time"}},"required":["id","name","slug","start_date","end_date"]}},"required":["id","event_id","ticket_id","position","status","created_at","event"]}]}},"required":["success","data"]}}}},"400":{"description":"Missing or invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Contact or waitlist entry not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/registrations/{id}/rsvp":{"patch":{"tags":["Events"],"summary":"Update RSVP","description":"Update RSVP status, dietary requirements, or notes for a registration.","security":[{"apiKey":["events.registrations.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Registration ID"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rsvp_status":{"type":"string","enum":["attending","not_attending","maybe","pending"],"description":"RSVP response"},"dietary_requirements":{"type":"string","maxLength":500,"description":"Dietary requirements"},"notes":{"type":"string","maxLength":1000,"description":"Additional notes"}},"required":["rsvp_status"]}}}},"responses":{"200":{"description":"RSVP updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventRsvpResult"}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Registration not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/{slug}/ical":{"get":{"tags":["Events"],"summary":"Download iCalendar file","description":"Download an RFC 5545 .ics file for a published event, suitable for import into any calendar application. For a members-only event, DESCRIPTION and the street address in LOCATION are included only when an optional member bearer token (`Authorization: Bearer <jwt>`) resolves to a contact holding a current membership with the organiser account; every other caller receives the event name, times and venue name only. Requires the events.events.browse scope.","security":[{"apiKey":["events.events.browse"]},{"apiKey":["events.events.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Event URL slug"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"iCalendar file","content":{"text/calendar":{"schema":{"type":"string","description":"RFC 5545 VCALENDAR content"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Event not found or not published","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/embed":{"get":{"tags":["Events"],"summary":"Get embed events","description":"Retrieve a curated list of events suitable for embedding in external sites.","security":[{"apiKey":["events.events.browse"]}],"parameters":[{"schema":{"type":"string","enum":["list","card","calendar"],"description":"Display layout: list, card, or calendar"},"required":false,"name":"layout","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":50,"description":"Maximum number of events to return"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Filter by category slug"},"required":false,"name":"category","in":"query"}],"responses":{"200":{"description":"Embed events retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventEmbedResponse"}},"required":["success","data"]}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/{slug}/tickets/{id}":{"patch":{"tags":["Events"],"summary":"Update a ticket","description":"Edit a ticket on an event. Account ownership verified via the parent event. Requires `events.tickets.update` scope.","security":[{"apiKey":["events.tickets.update"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTicketInput"}}}},"responses":{"200":{"description":"Ticket updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventTicket"}},"required":["success","data"]}}}},"404":{"description":"Ticket not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Events"],"summary":"Delete a ticket","description":"Soft-delete a ticket by marking it inactive (`is_active = false`). Tickets are never physically removed because registrations reference them. Requires `events.tickets.delete` scope.","security":[{"apiKey":["events.tickets.delete"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Ticket deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventDeletedResult"}},"required":["success","data"]}}}},"404":{"description":"Ticket not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/categories/{id}":{"patch":{"tags":["Events"],"summary":"Update an event category","description":"Edit category fields. Renaming updates the slug. Setting `parentId` to `null` makes the category a root. Requires `events.categories.update` scope.","security":[{"apiKey":["events.categories.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEventCategoryInput"}}}},"responses":{"200":{"description":"Category updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventCategory"}},"required":["success","data"]}}}},"404":{"description":"Category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Events"],"summary":"Delete an event category","description":"Delete a category. Rejects when child categories exist; mapping rows in `event_category_mappings` are removed first. Requires `events.categories.delete` scope.","security":[{"apiKey":["events.categories.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Category deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventDeletedResult"}},"required":["success","data"]}}}},"400":{"description":"Cannot delete category with child categories","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Category not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/venues/{id}":{"patch":{"tags":["Events"],"summary":"Update a venue","description":"Edit a venue owned by the calling account. Requires `events.venues.update` scope.","security":[{"apiKey":["events.venues.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateVenueInput"}}}},"responses":{"200":{"description":"Venue updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventVenue"}},"required":["success","data"]}}}},"404":{"description":"Venue not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Events"],"summary":"Delete a venue","description":"Hard-delete a venue. Requires `events.venues.delete` scope.","security":[{"apiKey":["events.venues.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Venue deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventDeletedResult"}},"required":["success","data"]}}}},"404":{"description":"Venue not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/{slug}/attendee-fields":{"get":{"tags":["Events"],"summary":"List attendee fields for an event","description":"Retrieve all custom fields defined for attendees of a specific event, ordered by `sort_order` ascending then `created_at` ascending. That sequence is the order the event organiser set in the admin, and it is contiguous and unambiguous within an event after any reorder (SPEC-CORE-20260728-custom-field-ordering).","security":[{"apiKey":["events.attendee_fields.browse"]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Event URL slug"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Attendee fields retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/AttendeeField"}}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Event not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Events"],"summary":"Create an attendee field","description":"Add a new custom field definition to an event.","security":[{"apiKey":["events.attendee_fields.manage"]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Event URL slug"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAttendeeFieldInput"}}}},"responses":{"201":{"description":"Attendee field created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AttendeeField"}},"required":["success","data"]}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Event not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/{slug}/attendee-fields/{id}":{"patch":{"tags":["Events"],"summary":"Update an attendee field","description":"Edit a custom field definition on an event.","security":[{"apiKey":["events.attendee_fields.manage"]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Event URL slug"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"Field ID"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAttendeeFieldInput"}}}},"responses":{"200":{"description":"Attendee field updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AttendeeField"}},"required":["success","data"]}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Event or field not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Events"],"summary":"Delete an attendee field","description":"Remove a custom field definition from an event.","security":[{"apiKey":["events.attendee_fields.manage"]}],"parameters":[{"schema":{"type":"string","minLength":1,"description":"Event URL slug"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"Field ID"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Attendee field deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EventDeletedResult"}},"required":["success","data"]}}}},"404":{"description":"Event or field not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/jobs":{"get":{"tags":["Jobs"],"summary":"List published jobs with optional filters","description":"Returns the active (published, not deleted, not expired) job listings for the API key's account. A job whose `expires_at` has passed is excluded. Supports text search, location, state, work arrangement, employment type, experience level, category and tag slugs, posting date, minimum shown salary and featured-only filters, combined with AND. Category, tag, employment type, work arrangement and experience level take several values as repeated keys: several tags must all match, several of any other filter match any of them. The list can put sponsored and featured listings first. Pass `lat`, `lng` and `radius` (km) together to list only jobs within that distance of a point; a job without stored coordinates is never listed then, each item carries its `distance_km`, and `sortBy=distance` orders nearest first. A radius search considers at most the 1000 nearest live jobs, so `total` counts matches within those. Add `includeRemote=true` to the radius search to also list live remote jobs wherever they are, filtered like the rest; a remote job outside the radius has a null `distance_km` and, under `sortBy=distance`, follows the jobs with a distance, newest first. It adds at most the 1000 newest remote jobs, and `total` and pagination cover the combined list. Each job includes its canonical subject topics. When a job has `show_salary` false, its `salary_min`, `salary_max` and `salary_range` are null. Embedded `categories` and `tags` list active ones only. Paginated and sortable. Requires `jobs.listings.browse` scope.","security":[{"apiKey":["jobs.listings.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["created_at","published_at","title","salary_min","salary_max","expires_at","distance"],"description":"`distance` orders nearest first, ignores `sortOrder`, and needs `lat`, `lng` and `radius` (400 without them). Remote jobs added by `includeRemote` without a distance follow, newest published first. `featuredFirst` still puts sponsored and featured listings ahead."},"required":false,"name":"sortBy","in":"query"},{"schema":{"type":"string","enum":["asc","desc"]},"required":false,"name":"sortOrder","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[^\"\\\\,()]+$"},"minItems":1,"maxItems":20,"description":"Active category slug (see `GET /v1/jobs/categories`). Repeat the key for several (`?category=a&category=b`, up to 20): a job in any of them matches."},"required":false,"name":"category","in":"query"},{"schema":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[^\"\\\\,()]+$"},"minItems":1,"maxItems":20,"description":"Active tag slug (see `GET /v1/jobs/tags`). Repeat the key for several (`?tag=a&tag=b`, up to 20): only a job carrying every one of them matches."},"required":false,"name":"tag","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":120,"description":"Matches part of the city, state, postcode or country."},"required":false,"name":"location","in":"query"},{"schema":{"type":"number","minimum":-90,"maximum":90,"description":"Latitude of the search point. Send with `lng` and `radius`, or none of the three."},"required":false,"name":"lat","in":"query"},{"schema":{"type":"number","minimum":-180,"maximum":180,"description":"Longitude of the search point. Send with `lat` and `radius`, or none of the three."},"required":false,"name":"lng","in":"query"},{"schema":{"type":"number","minimum":1,"maximum":1000,"description":"Search radius in kilometres, 1 to 1000. Send with `lat` and `lng`, or none of the three. Only jobs with stored coordinates within this distance are listed, unless `includeRemote` is true."},"required":false,"name":"radius","in":"query"},{"schema":{"type":"boolean","description":"With `lat`, `lng` and `radius`, `true` also lists live remote jobs (`location_type` remote) passing every other filter, whatever their coordinates. A job in both sets is listed once and keeps its `distance_km`; a remote job outside the radius has a null `distance_km`. Under `sortBy=distance` the jobs with a distance come first, nearest first, then the remote jobs without one, newest published first; `featuredFirst` still leads with sponsored and featured listings, each group in that order. Any other sort orders the combined list. Only `true` and `false` are accepted (400 otherwise). Defaults to `false`; ignored without a point."},"required":false,"name":"includeRemote","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[^*%_\\\\]+$","description":"Exact state or territory, case-insensitive (`NSW` matches `nsw`). Wildcard characters are rejected."},"required":false,"name":"state","in":"query"},{"schema":{"type":"array","items":{"type":"string","enum":["full-time","part-time","contract","casual","internship"]},"minItems":1,"maxItems":20,"description":"Employment type. Repeat the key for several: a job of any of them matches."},"required":false,"name":"type","in":"query"},{"schema":{"type":"array","items":{"type":"string","enum":["on-site","hybrid","remote"]},"minItems":1,"maxItems":20,"description":"Work arrangement. Repeat the key for several: a job with any of them matches."},"required":false,"name":"locationType","in":"query"},{"schema":{"type":"array","items":{"type":"string","enum":["entry","mid","senior","executive"]},"minItems":1,"maxItems":20,"description":"Experience level the listing asks for. Repeat the key for several: a job asking for any of them matches."},"required":false,"name":"experienceLevel","in":"query"},{"schema":{"type":"string","format":"date-time","description":"ISO 8601 date-time, `Z` or an offset (URL-encode a `+` as `%2B`). Only listings published at or after this moment."},"required":false,"name":"postedAfter","in":"query"},{"schema":{"type":"integer","minimum":0,"description":"Only listings whose shown salary reaches this: the shown maximum, or the shown minimum when the listing gives no maximum. Compared as written, across salary periods. A listing that hides its salary never matches."},"required":false,"name":"salaryMin","in":"query"},{"schema":{"type":"boolean"},"required":false,"name":"featuredOnly","in":"query"},{"schema":{"type":"boolean","description":"Order by sponsor level, then featured, ahead of `sortBy`."},"required":false,"name":"featuredFirst","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"Paginated jobs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobsListResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/jobs/categories":{"get":{"tags":["Jobs"],"summary":"List active job categories","description":"Returns the API key's account's active job categories in display order (`sort_order`, then name), for building a category filter. `parent_id` links a sub-category to its parent. Pass a `slug` to `GET /v1/jobs?category=`. Requires `jobs.listings.browse` scope.","security":[{"apiKey":["jobs.listings.browse"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"Active job categories","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobCategoriesResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/jobs/tags":{"get":{"tags":["Jobs"],"summary":"List active job tags","description":"Returns the API key's account's active job tags by name, for building a tag filter (for example salary bands or seniority a board curates as tags). Pass a `slug` to `GET /v1/jobs?tag=`. Requires `jobs.listings.browse` scope.","security":[{"apiKey":["jobs.listings.browse"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"Active job tags","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobTagsResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/jobs/{slugOrId}":{"get":{"tags":["Jobs"],"summary":"Get a published job by slug or UUID","description":"Looks up by slug first, then by UUID (only when the path segment matches the UUID pattern). Returns 404 if no published, unexpired job with that identifier exists in the API key's account; a job whose `expires_at` has passed returns 404. When the job has `show_salary` false, its `salary_min`, `salary_max` and `salary_range` are null. Embedded `categories` and `tags` list active ones only. Unlike the list, it carries the `reference_number`, `contact_name` and `contact_phone`; its `distance_km` is always null. Requires `jobs.listings.browse` scope.","security":[{"apiKey":["jobs.listings.browse"]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"slugOrId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"Job detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Job not found or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/jobs/submissions":{"get":{"tags":["Jobs"],"summary":"List a member's job submissions, named by contact pair","description":"Returns the member job submissions of the contact holding the pair `external_source` and `external_id` in the API key's organisation, in every status, newest `submitted_at` first. A pair no contact holds returns an empty list. Each item is the single job plus `status` (`checking_credit`, `pending`, `no_credit`, `approved`, `rejected`, `withdrawn` or `closed`), `expired` on an `approved` job, `filled` on a `closed` one, `rejection_reason`, `credit_ref` (null until a credit is spent), `submitted_at`, `reviewed_at` and the `contact`. Reads nothing from Upbeat. Requires the `jobs.submissions.browse` scope and no user bearer token. Errors: `400` `VALIDATION_ERROR` naming the field; `403` `SOURCE_NOT_ALLOWED`, `JOB_SUBMISSIONS_DISABLED` or `INSUFFICIENT_SCOPES`; `429`.","security":[{"apiKey":["jobs.submissions.browse"]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"The contact's source, for example `upbeat-contacts` for an Upbeat site. Must be one of the API key's allowed contact sources."},"required":true,"name":"external_source","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"The contact's id in that source, for example the membership number."},"required":true,"name":"external_id","in":"query"},{"schema":{"type":"integer","minimum":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"The contact's submissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactJobSubmissionsListResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"`SOURCE_NOT_ALLOWED` when the key does not list `external_source`, `JOB_SUBMISSIONS_DISABLED` when the organisation has not enabled member job submissions, or `INSUFFICIENT_SCOPES`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Jobs"],"summary":"Post a job for a member named by contact pair","description":"Accepts a job for the member the contact pair names and answers `202` with the submission in `checking_credit`. Agend then reads the member's unused CRM job credits and moves the submission to `pending` with one credit spent, or to `no_credit`; poll `GET /v1/jobs/submissions/{id}` every 3 seconds for up to 30 seconds. `job` takes the job fields of the request body schema. `credit_ref` is refused: Agend writes it when a credit is spent. Any other key in `job` or `contact` is refused and named, for example `job.credit_ref`. The contact is found by `external_source` and `external_id` together; an existing contact is never changed, and no contact is ever matched by email. When no contact holds the pair, one is created from `first_name`, `last_name` and `email`, tagged `created-by-jobs`, and `contact_created` is `true`; for an `upbeat-contacts` pair, the one SSO contact Agend would adopt for that membership number is used instead. Every `category_ids` and `tag_ids` entry must be an active category or tag of the organisation. Honours `Idempotency-Key`: a repeat with the same key and body replays the first response with `Idempotency-Replayed: true`. Approvers are emailed when the submission reaches `pending`, not when it is accepted. Requires the `jobs.submissions.create` scope and no user bearer token. Errors: `400` `VALIDATION_ERROR` naming the field; `403` `SOURCE_NOT_ALLOWED`, `JOB_CREDITS_NOT_CONFIGURED`, `JOB_SUBMISSIONS_DISABLED` or `INSUFFICIENT_SCOPES`; `404` `JOB_NOT_FOUND` when an idempotent replay names a job this key did not create; `409` `CONTACT_CONFLICT`, `IDEMPOTENCY_KEY_REUSED` or `IDEMPOTENCY_IN_PROGRESS`; `429`.","security":[{"apiKey":["jobs.submissions.create"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"},{"schema":{"type":"string","minLength":1,"maxLength":255},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContactSubmissionBody"}}}},"responses":{"202":{"description":"The submission was accepted and its credit is being checked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSubmissionAcceptedResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"`SOURCE_NOT_ALLOWED`, `JOB_CREDITS_NOT_CONFIGURED`, `JOB_SUBMISSIONS_DISABLED` or `INSUFFICIENT_SCOPES`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"`JOB_NOT_FOUND`: an idempotent replay names a job this key did not create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"`CONTACT_CONFLICT`: more than one existing SSO contact could be this member and nothing was created; `IDEMPOTENCY_KEY_REUSED` or `IDEMPOTENCY_IN_PROGRESS`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/jobs/credits":{"get":{"tags":["Jobs"],"summary":"Read how many job credits a member has, named by contact pair","description":"Returns `available`, the number of unused CRM job credits the member holds under the organisation's job credit setting, `checked_at`, when that count was read, and `stale`. A count younger than 60 seconds is returned at once. Otherwise a fresh count is requested and returned if it lands within 8 seconds; if not, the older count is returned with `stale: true`. A pair no contact holds is counted by membership number all the same. A source other than `upbeat-contacts` returns `available: 0`. The gateway reads nothing from Upbeat itself. Requires the `jobs.submissions.browse` scope and no user bearer token. Errors: `400` `VALIDATION_ERROR` naming the field; `403` `SOURCE_NOT_ALLOWED`, `JOB_CREDITS_NOT_CONFIGURED`, `JOB_SUBMISSIONS_DISABLED` or `INSUFFICIENT_SCOPES`; `429`; `503` `CREDIT_COUNT_UNAVAILABLE` with `Retry-After: 5` when no count exists yet and none arrived in time.","security":[{"apiKey":["jobs.submissions.browse"]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"The contact's source, for example `upbeat-contacts` for an Upbeat site. Must be one of the API key's allowed contact sources."},"required":true,"name":"external_source","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"The contact's id in that source, for example the membership number."},"required":true,"name":"external_id","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"The member's unused job credit count","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobCreditCountResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"`SOURCE_NOT_ALLOWED` when the key does not list `external_source`, `JOB_CREDITS_NOT_CONFIGURED` when the organisation has no job credit setting, `JOB_SUBMISSIONS_DISABLED` when the organisation has not enabled member job submissions, or `INSUFFICIENT_SCOPES`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"`CREDIT_COUNT_UNAVAILABLE`: no count exists for the member yet and none arrived within 8 seconds. Retry after the `Retry-After` interval (5 seconds).","headers":{"Retry-After":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/jobs/submissions/{id}":{"get":{"tags":["Jobs"],"summary":"Read one of a member's job submissions, named by contact pair","description":"Returns one submission when it belongs to the contact holding the pair. An id that does not exist, is not a UUID, or belongs to another organisation or contact, and a pair no contact holds, return the same `404` `JOB_NOT_FOUND`. Requires the `jobs.submissions.browse` scope and no user bearer token. Errors: `400` `VALIDATION_ERROR` naming the field; `403` `SOURCE_NOT_ALLOWED`, `JOB_SUBMISSIONS_DISABLED` or `INSUFFICIENT_SCOPES`; `404` `JOB_NOT_FOUND`; `429`.","security":[{"apiKey":["jobs.submissions.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"The submission's job id. An id that does not exist, is not a UUID, or belongs to another organisation or contact returns the same `404`."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"The contact's source, for example `upbeat-contacts` for an Upbeat site. Must be one of the API key's allowed contact sources."},"required":true,"name":"external_source","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"The contact's id in that source, for example the membership number."},"required":true,"name":"external_id","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"The submission","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactJobSubmissionResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"`SOURCE_NOT_ALLOWED` when the key does not list `external_source`, `JOB_SUBMISSIONS_DISABLED` when the organisation has not enabled member job submissions, or `INSUFFICIENT_SCOPES`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"`JOB_NOT_FOUND`: the same response for an id that does not exist, is malformed, or belongs to another organisation or contact, and for a pair no contact holds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["Jobs"],"summary":"Edit a member's pending job submission, named by contact pair","description":"Writes the `job` fields sent to the contact's own submission while it is `pending`, leaves every field not sent unchanged and keeps it `pending`. `job` takes the `POST /v1/jobs/submissions` fields, all optional, with the same validation; an optional field sent as `null` is cleared, and `category_ids` and `tag_ids` replace the links. Any other key in `contact` or `job` is refused and named. An id that does not exist, is not a UUID, or belongs to another organisation or contact, and a pair no contact holds, return the same `404`. Requires the `jobs.submissions.manage` scope and no user bearer token. Errors: `400` `VALIDATION_ERROR`; `403` `SOURCE_NOT_ALLOWED`, `JOB_SUBMISSIONS_DISABLED` or `INSUFFICIENT_SCOPES`; `404` `JOB_NOT_FOUND`; `409` `JOB_NOT_EDITABLE` when the submission is not `pending`; `429`.","security":[{"apiKey":["jobs.submissions.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"The submission's job id. An id that does not exist, is not a UUID, or belongs to another organisation or contact returns the same `404`."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContactSubmissionBody"}}}},"responses":{"200":{"description":"The updated submission","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactJobSubmissionUpdateResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"`SOURCE_NOT_ALLOWED` when the key does not list `external_source`, `JOB_SUBMISSIONS_DISABLED` when the organisation has not enabled member job submissions, or `INSUFFICIENT_SCOPES`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"`JOB_NOT_FOUND`: the same response for an id that does not exist, is malformed, or belongs to another organisation or contact, and for a pair no contact holds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"`JOB_NOT_EDITABLE`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/jobs/submissions/{id}/withdraw":{"post":{"tags":["Jobs"],"summary":"Withdraw a member's pending job submission, named by contact pair","description":"Sets the contact's own `pending` submission to `withdrawn`, which is final, releases its CRM job credit spend and writes the `jobs.submission.withdrawn` webhook, all in one transaction. Agend then sets the credit's `downloadCount` back to `0` in Upbeat, so the credit is available for the member's next post. Requires the `jobs.submissions.manage` scope and no user bearer token. Errors: `400` `VALIDATION_ERROR`; `403` `SOURCE_NOT_ALLOWED`, `JOB_SUBMISSIONS_DISABLED` or `INSUFFICIENT_SCOPES`; `404` `JOB_NOT_FOUND`; `409` `INVALID_STATUS_TRANSITION` when the submission is not `pending`; `429`.","security":[{"apiKey":["jobs.submissions.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"The submission's job id. An id that does not exist, is not a UUID, or belongs to another organisation or contact returns the same `404`."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WithdrawContactSubmissionBody"}}}},"responses":{"200":{"description":"The withdrawn submission","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactJobSubmissionWithdrawResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"`SOURCE_NOT_ALLOWED` when the key does not list `external_source`, `JOB_SUBMISSIONS_DISABLED` when the organisation has not enabled member job submissions, or `INSUFFICIENT_SCOPES`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"`JOB_NOT_FOUND`: the same response for an id that does not exist, is malformed, or belongs to another organisation or contact, and for a pair no contact holds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"`INVALID_STATUS_TRANSITION`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/jobs/submissions/{id}/close":{"post":{"tags":["Jobs"],"summary":"Close or fill a member's approved job, named by contact pair","description":"Takes the contact's own `approved` submission off the board. With `filled: true` it is stored as filled; with `filled: false` or no `filled` it is stored as closed. Both report `status: \"closed\"`, with `filled` stating which. Closing is final, writes no webhook and does not release the CRM job credit spend: the credit bought the listing. Requires the `jobs.submissions.manage` scope and no user bearer token. Errors: `400` `VALIDATION_ERROR`; `403` `SOURCE_NOT_ALLOWED`, `JOB_SUBMISSIONS_DISABLED` or `INSUFFICIENT_SCOPES`; `404` `JOB_NOT_FOUND`; `409` `INVALID_STATUS_TRANSITION` when the submission is not `approved`; `429`.","security":[{"apiKey":["jobs.submissions.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"The submission's job id. An id that does not exist, is not a UUID, or belongs to another organisation or contact returns the same `404`."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseContactSubmissionBody"}}}},"responses":{"200":{"description":"The closed submission","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactJobSubmissionCloseResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"`SOURCE_NOT_ALLOWED` when the key does not list `external_source`, `JOB_SUBMISSIONS_DISABLED` when the organisation has not enabled member job submissions, or `INSUFFICIENT_SCOPES`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"`JOB_NOT_FOUND`: the same response for an id that does not exist, is malformed, or belongs to another organisation or contact, and for a pair no contact holds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"`INVALID_STATUS_TRANSITION`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/lessons/{id}/content":{"get":{"tags":["LMS"],"summary":"Get authenticated lesson content","description":"Returns the deliverable content for a lesson the calling member is enrolled in and that has dripped: a signed media URL, inline HTML, PDF page manifest, external URL, or a `processing` state, discriminated by `type`. A stored document that has not finished protected processing returns `{ \"type\": \"processing\", \"status\": ... }` with no file URL rather than the original file. When the organisation allows document downloads and a document lesson has finished processing, the `pdf-pages` response also carries `download`: a signed URL to the PDF version, never the uploaded Word or PowerPoint original. A Stream video without a ready playback asset returns a signed media URL only when its exact stored fallback object exists. Requires the `lms.content.browse` scope and an active LMS subscription. Legacy callers use an API key plus Supabase user bearer; mobile callers use the ordinary bearer plus an organisation-scoped mobile session. Identity is taken exclusively from the validated credentials, never a parameter. A lesson that is enrolled but not yet unlocked returns `423 Locked` with `error.details.unlockTime`.","security":[{"apiKey":["lms.content.browse"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","description":"Lesson id."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Lesson content resolved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LmsLessonContent"}},"required":["success","data"]}}}},"400":{"description":"Invalid lesson id or content could not be resolved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Not enrolled, or key lacks lms.content.browse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Lesson not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"423":{"description":"Enrolled but the lesson has not dripped yet; see error.details.unlockTime","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Content access verification or signing failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses":{"get":{"tags":["LMS"],"summary":"List courses","description":"List published courses and their topics owned by the calling account. The account is derived from the API key. A course whose available-from date is in the future and which is not set to show as coming soon is omitted from the items and the total. Difficulty uses the organisation-configured stable key; labels may be renamed and unavailable levels remain on existing courses. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: when valid, each item is enriched with `my_enrollment` (the member completion summary); an invalid bearer is rejected. Identity is carried only by the validated JWT, never a parameter. Each course carries `external_ref`, the opaque identifier of its counterpart in an external system of record (null when it has none), for correlating courses with external systems. Requires the lms.courses.browse scope in both modes. Course descriptions never expose private `agend-storage:` markers; embedded files are returned as unavailable text on this API surface. Sunset notice: the deprecated `category` and `course_category` fields are compatibility projections of the first topic and will be removed in a future API version; use `topics`.","security":[{"apiKey":["lms.courses.browse"]},{"apiKey":["lms.courses.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100},"required":false,"name":"category","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9_-]+$"},"required":false,"name":"difficulty","in":"query"},{"schema":{"type":"string","enum":["self_paced","live_online","in_person","blended"]},"required":false,"name":"deliveryMode","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100},"maxItems":50},"required":false,"name":"excludeCategories","in":"query"},{"schema":{"type":"array","items":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9_-]+$"},"maxItems":100},"required":false,"name":"excludeDifficulties","in":"query"},{"schema":{"type":"array","items":{"type":"string","enum":["self_paced","live_online","in_person","blended"]},"maxItems":4},"required":false,"name":"excludeDeliveryModes","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":true},"required":false,"name":"published","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Courses retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Course"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["LMS"],"summary":"Create a course","description":"Course titles accept up to 2000 characters. Prices are in dollars and GST-inclusive. A nullable member_price applies to current members, has a minimum of 0.50 dollars and at most two decimal places, and must not exceed base_price. Create a new draft course owned by the calling account. After creation and topic assignment succeed, the account-scoped `lms.course.created` workflow event is announced on a best-effort basis. Workflow transport failure does not roll back the course. Requires `lms.courses.create` scope. The `owner_account_id` is derived from the API key. Sunset notice: the deprecated `category` and `course_category` fields are compatibility projections of the first topic and will be removed in a future API version; use `topics`.","security":[{"apiKey":["lms.courses.create"],"userBearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCourseInput"}}}},"responses":{"201":{"description":"Course created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Course"}},"required":["success","data"]}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}":{"get":{"tags":["LMS"],"summary":"Get a course by id or slug","description":"Scoped to the calling account (derived from the API key). Cross-tenant access returns 404. Optionally supply a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: when valid, the response is enriched with `my_enrollment` (the member full enrolment progress); an invalid bearer is rejected. Identity is carried only by the validated JWT, never a parameter. The course carries `external_ref`, the opaque identifier of its counterpart in an external system of record (null when it has none). Requires the lms.courses.browse scope in both modes. Course descriptions never expose private `agend-storage:` markers; embedded files are returned as unavailable text on this API surface. Sunset notice: the deprecated `category` and `course_category` fields are compatibility projections of the first topic and will be removed in a future API version; use `topics`.","security":[{"apiKey":["lms.courses.browse"]},{"apiKey":["lms.courses.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","description":"Course UUID or slug"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Course retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CourseDetail"}},"required":["success","data"]}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["LMS"],"summary":"Update a course","description":"Course titles accept up to 2000 characters. Prices are in dollars and GST-inclusive. A nullable member_price applies to current members, has a minimum of 0.50 dollars and at most two decimal places, and must not exceed base_price. Edit a course owned by the calling account. Cross-tenant access returns 404. Requires `lms.courses.update` scope. An optional gateway-validated bearer attributes the change: a publish flip records that member as the actor on the `lms.course.published` events. Sunset notice: the deprecated `category` and `course_category` fields are compatibility projections of the first topic and will be removed in a future API version; use `topics`.","security":[{"apiKey":["lms.courses.update"]},{"apiKey":["lms.courses.update"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCourseInput"}}}},"responses":{"200":{"description":"Course updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Course"}},"required":["success","data"]}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Course type is incomplete or Course Duration is unavailable for an organisation with On-demand courses enabled. The message names the field to correct on the Access tab.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["LMS"],"summary":"Delete a course","description":"Delete a course owned by the calling account. Cross-tenant access returns 404. Requires `lms.courses.delete` scope.","security":[{"apiKey":["lms.courses.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Course deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DeletedResult"}},"required":["success","data"]}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/lessons":{"get":{"tags":["LMS"],"summary":"List lessons for a course","description":"Scoped to the calling account (derived from the API key). Cross-tenant access returns 404.","security":[{"apiKey":["lms.lessons.browse"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Lessons retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CourseLessons"}},"required":["success","data"]}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["LMS"],"summary":"Create a draft lesson","description":"Creates a text or video lesson in an owned draft course. Text requires Markdown content and no video_asset_id. Video requires exactly one of an approved HTTPS video URL in content or a verified video_asset_id from this account, key and course. Internal storage/Stream markers are rejected. Idempotency-Key is required (1–128 visible ASCII characters); identical retries resolve one lesson. Requires lms.lessons.create.","security":[{"apiKey":["lms.lessons.create"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[\\x21-\\x7e]+$"},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["text","video"]},"content":{"type":"string","minLength":1,"maxLength":1000000},"video_asset_id":{"type":"string","format":"uuid"},"order_index":{"type":"integer","minimum":0,"maximum":2147483647},"duration_minutes":{"type":["integer","null"],"minimum":0,"maximum":2147483647}},"required":["title","type"],"additionalProperties":false}}}},"responses":{"201":{"description":"Lesson created or returned from an identical retry","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LessonRow"}},"required":["success","data"]}}}},"400":{"description":"Malformed JSON or invalid course id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Course is not a draft or idempotency key conflicts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Lesson body is invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/video-uploads":{"post":{"tags":["LMS"],"summary":"Allocate a managed video upload","description":"Creates an account- and course-scoped resumable upload intent. The response contains a short-lived transport token; do not log or cache it. `Idempotency-Key` is required (1–128 visible ASCII characters). Requires `lms.videos.create`.","security":[{"apiKey":["lms.videos.create"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[\\x21-\\x7e]+$"},"required":true,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"file_name":{"type":"string","minLength":1,"maxLength":255},"file_size":{"type":"integer","exclusiveMinimum":0},"content_type":{"type":"string","enum":["video/mp4","video/quicktime","video/webm"]}},"required":["file_name","file_size","content_type"],"additionalProperties":false}}}},"responses":{"201":{"description":"Upload intent and scoped resumable authorisation created","headers":{"Cache-Control":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthoringUploadAuthorisation"}},"required":["success","data"]}}}},"400":{"description":"Malformed JSON or invalid course id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Idempotency key conflicts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Video exceeds the course-files bucket limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Video filename extension and MIME type do not match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Upload body is invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Managed video ingest is not enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/video-uploads/{uploadId}/authorisation":{"post":{"tags":["LMS"],"summary":"Refresh upload transport authorisation","description":"Issues a fresh scoped transport token for the same active upload intent. It never extends the intent or revives an expired or cancelled upload. Requires `lms.videos.create`.","security":[{"apiKey":["lms.videos.create"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"uploadId","in":"path"}],"responses":{"200":{"description":"Fresh scoped upload authorisation","headers":{"Cache-Control":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthoringUploadAuthorisation"}},"required":["success","data"]}}}},"404":{"description":"Upload not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Upload is no longer active","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Managed video ingest is not enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/video-uploads/{uploadId}/complete":{"post":{"tags":["LMS"],"summary":"Complete and register a managed video upload","description":"Verifies the stored object, registers or reuses its LMS asset and dispatches the Learn ingest event. Transport completion does not mean the video is ready. Requires `lms.videos.create`.","security":[{"apiKey":["lms.videos.create"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"uploadId","in":"path"}],"responses":{"202":{"description":"Asset registered and processing is pending","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthoringUploadStatus"}},"required":["success","data"]}}}},"404":{"description":"Upload not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Upload cannot be completed in its current state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Managed video ingest is not enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/video-uploads/{uploadId}":{"get":{"tags":["LMS"],"summary":"Get managed video upload status","description":"Returns durable transport, dispatch and processing state without playback URLs or provider credentials. Requires `lms.videos.browse`.","security":[{"apiKey":["lms.videos.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"uploadId","in":"path"}],"responses":{"200":{"description":"Upload status","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthoringUploadStatus"}},"required":["success","data"]}}}},"404":{"description":"Upload not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["LMS"],"summary":"Cancel a pending managed video upload","description":"Cancels an uncompleted upload intent. Registered or attached media cannot be cancelled. Requires `lms.videos.create`.","security":[{"apiKey":["lms.videos.create"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"uploadId","in":"path"}],"responses":{"200":{"description":"Upload cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AuthoringUploadStatus"}},"required":["success","data"]}}}},"404":{"description":"Upload not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Upload is already registered or attached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/enroll":{"post":{"tags":["LMS"],"summary":"Enroll a user in a course","description":"Requires the `lms.enrollments.manage` scope. When `seat_license_id` is supplied, the licence must belong to the API key's account and apply to the course; it must be active, unexpired and have a free seat. A successful enrolment consumes one seat.","security":[{"apiKey":["lms.enrollments.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"seat_license_id":{"type":"string","format":"uuid"}},"required":["user_id"]}}}},"responses":{"201":{"description":"Enrollment created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CourseEnrollResult"}},"required":["success","data"]}}}},"400":{"description":"Course not published, or the seat licence does not apply to this course","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Course not found, or the seat licence is not in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"User already enrolled, or the seat licence is inactive, expired or out of seats","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/conclude":{"post":{"tags":["LMS"],"summary":"Conclude a published course","description":"Transitions a published course to 'concluded'. Requires the lms.courses.manage scope. The transition is recorded with actor_type 'system' and emits lms.course.concluded.","security":[{"apiKey":["lms.courses.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"Course concluded","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CourseLifecycleResult"}},"required":["success","data"]}}}},"400":{"description":"Course is not in a concludable state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/archive":{"post":{"tags":["LMS"],"summary":"Archive a concluded course","description":"Archives a concluded course. Requires the lms.courses.manage scope. Recorded with actor_type 'system' (only concluded → archived is permitted for machine callers) and emits lms.course.archived.","security":[{"apiKey":["lms.courses.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"Course archived","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CourseLifecycleResult"}},"required":["success","data"]}}}},"400":{"description":"Course is not in an archivable state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/from-template":{"post":{"tags":["LMS"],"summary":"Duplicate an archived course into a new draft","description":"Copies an archived course (lessons, quizzes, and questions included) into a fresh draft owned by the same account. Requires the lms.courses.manage scope. Emits lms.course.duplicated.","security":[{"apiKey":["lms.courses.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"201":{"description":"New draft course created from the template","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CourseFromTemplateResult"}},"required":["success","data"]}}}},"400":{"description":"Source course is not archived","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Source course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/quiz":{"get":{"tags":["LMS"],"summary":"Get a course's quiz with questions","security":[{"apiKey":["lms.quizzes.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Quiz with questions","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/QuizWithQuestions"}},"required":["success","data"]}}}},"404":{"description":"Course or quiz not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["LMS"],"summary":"Create the quiz for a course","description":"Requires the lms.quizzes.create scope. Emits lms.quiz.created.","security":[{"apiKey":["lms.quizzes.create"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":255},"description":{"type":["string","null"],"maxLength":5000},"passing_score":{"type":"integer","minimum":0,"maximum":100,"default":70},"time_limit_minutes":{"type":["integer","null"],"exclusiveMinimum":0},"max_attempts":{"type":["integer","null"],"exclusiveMinimum":0}},"required":["title"]}}}},"responses":{"201":{"description":"Quiz created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Quiz"}},"required":["success","data"]}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["LMS"],"summary":"Update a course's quiz","description":"Requires the lms.quizzes.update scope. Emits lms.quiz.updated.","security":[{"apiKey":["lms.quizzes.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":255},"description":{"type":["string","null"],"maxLength":5000},"passing_score":{"type":"integer","minimum":0,"maximum":100,"default":70},"time_limit_minutes":{"type":["integer","null"],"exclusiveMinimum":0},"max_attempts":{"type":["integer","null"],"exclusiveMinimum":0}}}}}},"responses":{"200":{"description":"Quiz updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Quiz"}},"required":["success","data"]}}}},"404":{"description":"Course or quiz not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["LMS"],"summary":"Delete a course's quiz","description":"Requires the lms.quizzes.delete scope. Emits lms.quiz.deleted.","security":[{"apiKey":["lms.quizzes.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Quiz deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DeletedResult"}},"required":["success","data"]}}}},"404":{"description":"Course or quiz not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/badges":{"post":{"tags":["LMS"],"summary":"Award a course badge to a user","description":"Requires the lms.badges.manage scope. Emits lms.badge.awarded.","security":[{"apiKey":["lms.badges.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"badge_name":{"type":"string","minLength":1,"maxLength":255},"badge_color":{"type":["string","null"],"maxLength":50},"badge_image_url":{"type":["string","null"],"format":"uri"},"is_public":{"type":"boolean","default":false}},"required":["user_id","badge_name"]}}}},"responses":{"201":{"description":"Badge awarded","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Badge"}},"required":["success","data"]}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"User already holds a badge for this course","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/badges/{badgeId}":{"delete":{"tags":["LMS"],"summary":"Revoke a course badge","description":"Requires the lms.badges.manage scope. Emits lms.badge.revoked.","security":[{"apiKey":["lms.badges.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"badgeId","in":"path"}],"responses":{"200":{"description":"Badge revoked","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/RevokedResult"}},"required":["success","data"]}}}},"404":{"description":"Course or badge not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/paths":{"get":{"tags":["LMS"],"summary":"List learning paths","description":"Lists published learning paths owned by the calling account. The account is derived from the API key.","security":[{"apiKey":["lms.paths.browse"]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9_-]+$"},"required":false,"name":"difficulty","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":true},"required":false,"name":"published","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Paths retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/LearningPath"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}}}},"post":{"tags":["LMS"],"summary":"Create a learning path","description":"Create a new learning path owned by the calling account. Requires `lms.paths.create` scope.","security":[{"apiKey":["lms.paths.create"],"userBearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePathInput"}}}},"responses":{"201":{"description":"Path created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LearningPath"}},"required":["success","data"]}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/paths/{id}":{"get":{"tags":["LMS"],"summary":"Get a learning path with its courses","description":"Scoped to the calling account (derived from the API key). Cross-tenant access returns 404.","security":[{"apiKey":["lms.paths.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Path retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LearningPathDetail"}},"required":["success","data"]}}}},"404":{"description":"Path not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["LMS"],"summary":"Update a learning path","description":"Edit a path owned by the calling account. Cross-tenant access returns 404. Requires `lms.paths.update` scope.","security":[{"apiKey":["lms.paths.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePathInput"}}}},"responses":{"200":{"description":"Path updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LearningPath"}},"required":["success","data"]}}}},"404":{"description":"Path not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["LMS"],"summary":"Delete a learning path","description":"Delete a path owned by the calling account. Requires `lms.paths.delete` scope.","security":[{"apiKey":["lms.paths.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Path deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DeletedResult"}},"required":["success","data"]}}}},"404":{"description":"Path not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/paths/{id}/enroll":{"post":{"tags":["LMS"],"summary":"Enroll a user in a learning path","security":[{"apiKey":["lms.enrollments.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"}},"required":["user_id"]}}}},"responses":{"201":{"description":"Enrollment created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/PathEnrollResult"}},"required":["success","data"]}}}},"400":{"description":"Path not published","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Path not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"User already enrolled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/paths/{id}/progress":{"get":{"tags":["LMS"],"summary":"Get a user's progress on a learning path","security":[{"apiKey":["lms.progress.read"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Progress retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/PathProgress"}},"required":["success","data"]}}}},"404":{"description":"Path not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/me/enrollments":{"get":{"tags":["LMS"],"summary":"List enrollments for the authenticated user","description":"Returns the LMS enrollments and CPD summary for the CRM contact linked to the user identified by the bearer token. Identity is derived exclusively from the bearer JWT (`Authorization: Bearer <jwt>`); no `contact_id` parameter is accepted.","security":[{"apiKey":["lms.enrollments.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","enum":["active","completed","all"],"default":"all"},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Enrollments retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Enrollment"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact exists for the user in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/me/enrollments/{courseId}":{"get":{"tags":["LMS"],"summary":"Get the authenticated member's enrolment for one course","description":"Returns the bearer-identified member's enrolment for a single course (progress, CPD, last-accessed, certificate) — the fields the LMS widget detail sidebar renders. Identity is derived exclusively from the bearer JWT; no contact/user identifier is accepted. A 404 means the member is not enrolled. Requires `lms.enrollments.browse`.","security":[{"apiKey":["lms.enrollments.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"courseId","in":"path"}],"responses":{"200":{"description":"Enrollment retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyCourseEnrollmentResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"The member is not enrolled in this course","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/enrollments":{"get":{"tags":["LMS"],"summary":"List enrollments for a CRM contact","description":"Resolves the contact (scoped to the calling account) to its linked user and returns enrollments plus a CPD summary.","security":[{"apiKey":["lms.enrollments.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"contactId","in":"query"},{"schema":{"type":"string","enum":["active","completed","expired"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"expiringBefore","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Enrollments retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Enrollment"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"404":{"description":"Contact not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/enrollments/{id}/access":{"get":{"tags":["LMS"],"summary":"Get the access status for an enrolment","description":"Returns the live access state for an enrolment: whether the learner can currently access content, the access mode, when access expires, days remaining, and why access ended if it has. Requires the `lms.enrollments.browse` scope. Scoped to the calling account; cross-tenant ids return 404.","security":[{"apiKey":["lms.enrollments.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Access status retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EnrollmentAccessStatus"}},"required":["success","data"]}}}},"404":{"description":"Enrollment not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/enrollments/{id}/access/extend":{"post":{"tags":["LMS"],"summary":"Extend an enrolment's access window","description":"Adds `days` to the enrolment access expiry and returns access to full mode. Emits the `lms.enrollment.access_extended` webhook event and returns the refreshed access status. Requires the `lms.enrollments.manage` scope. Scoped to the calling account; cross-tenant ids return 404.","security":[{"apiKey":["lms.enrollments.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer","minimum":1,"maximum":3650}},"required":["days"]}}}},"responses":{"200":{"description":"Access extended","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EnrollmentAccessStatus"}},"required":["success","data"]}}}},"400":{"description":"Invalid body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Enrollment not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/enrollments/{id}/access/restore":{"post":{"tags":["LMS"],"summary":"Restore access to an expired enrolment","description":"Returns an expired enrolment to full access. `access_expires_at` sets the new expiry; omit it (or send an empty body) to restore access with no time limit. Emits the `lms.enrollment.access_restored` webhook event and returns the refreshed access status. Requires the `lms.enrollments.manage` scope. Scoped to the calling account; cross-tenant ids return 404.","security":[{"apiKey":["lms.enrollments.manage"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"access_expires_at":{"type":"string","format":"date-time"}}}}}},"responses":{"200":{"description":"Access restored","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/EnrollmentAccessStatus"}},"required":["success","data"]}}}},"400":{"description":"Invalid body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Enrollment not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/users/{id}/enrollments":{"get":{"tags":["LMS"],"summary":"List enrollments for a user","security":[{"apiKey":["lms.users.read"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["active","completed","all"],"default":"all"},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Enrollments retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/UserEnrollment"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}}}}},"/v1/lms/users/{id}/progress":{"get":{"tags":["LMS"],"summary":"Get aggregated user progress across courses","security":[{"apiKey":["lms.users.read"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"courseId","in":"query"}],"responses":{"200":{"description":"Progress retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/UserProgress"}},"required":["success","data"]}}}}}}},"/v1/lms/users/{id}/cpd":{"get":{"tags":["LMS"],"summary":"Get CPD balance, awards, and badges for a user","security":[{"apiKey":["lms.users.read"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"CPD retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/UserCpd"}},"required":["success","data"]}}}},"404":{"description":"User has no records in this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/certificates/verify/{code}":{"get":{"tags":["LMS"],"summary":"Verify a certificate by code","description":"API-key gated under `lms.certificates.verify`. The legacy route was anonymous; the gateway requires a key because the verification response is tied to an account. Returns `{ valid: false, certificate: null }` for unknown codes (no 404) to avoid enumeration leaks. `certificate_url` is always null: the PDF is private and is never exposed through verification.","security":[{"apiKey":["lms.certificates.verify"]}],"parameters":[{"schema":{"type":"string","minLength":8,"maxLength":100,"pattern":"^[A-Za-z0-9-_]+$"},"required":true,"name":"code","in":"path"}],"responses":{"200":{"description":"Verification envelope","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CertificateVerification"}},"required":["success","data"]}}}}}}},"/v1/lms/badges/verify/{token}":{"get":{"tags":["LMS"],"summary":"Verify a learner badge by share token","description":"API-key gated under `lms.badges.verify`. Returns the focused badge shape (name, colour, image, earned_at, linked course, earner display name) plus a server timestamp. Returns `{ valid: false, badge: null }` for unknown, non-public, or expired tokens to avoid enumeration leaks. Distinct from `/v1/lms/certificates/verify/{code}` which is polymorphic across certificate id / verification code / cpd award id / badge token.","security":[{"apiKey":["lms.badges.verify"]}],"parameters":[{"schema":{"type":"string","minLength":8,"maxLength":100,"pattern":"^[A-Za-z0-9-_]+$"},"required":true,"name":"token","in":"path"}],"responses":{"200":{"description":"Verification envelope","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/BadgeVerification"}},"required":["success","data"]}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/certificates/{id}/download":{"get":{"tags":["LMS"],"summary":"Download a certificate PDF","security":[{"apiKey":["lms.certificates.read"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"PDF file","content":{"application/pdf":{"schema":{"type":"string"}}}},"400":{"description":"Certificate PDF not yet generated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Certificate not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/certificates/{id}/generate":{"post":{"tags":["LMS"],"summary":"Generate (render and upload) a certificate PDF","description":"Renders the PDF into the private certificates bucket and returns a short-lived signed download URL in `pdf_url`. If the PDF was previously rendered, a fresh signed URL is returned with `already_generated: true`.","security":[{"apiKey":["lms.certificates.generate"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Generation complete","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/CertificateGenerateResult"}},"required":["success","data"]}}}},"404":{"description":"Certificate not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/public/blocks/discovery":{"get":{"tags":["LMS"],"summary":"List LMS frontend block types","description":"API-key gated under `lms.courses.browse`. Returns the static catalogue of LMS block types available for embedding (course-catalog, featured-courses, learning-paths, cpd-balance).","security":[{"apiKey":["lms.courses.browse"]}],"responses":{"200":{"description":"Block catalogue","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LmsBlocksDiscovery"}},"required":["success","data"]}}}}}}},"/v1/lms/lessons/{id}":{"patch":{"tags":["LMS"],"summary":"Update a lesson","description":"Edit a lesson belonging to a course owned by the calling account. To attach managed media, send only `video_asset_id`; mixed attachment and lesson edits are rejected. Forged internal storage or Stream markers are rejected. A lesson of type `external_link` stores its destination in `content`, which must be an HTTPS URL, and may carry a `description`. Content may be omitted when an existing Link lesson only changes its description; changing another lesson to `external_link` requires an HTTPS `content`. Cross-tenant access returns 404. Requires `lms.lessons.update` scope.","security":[{"apiKey":["lms.lessons.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["text","video","pdf","scorm","interactive","url_embed","external_link"]},"order_index":{"type":"integer","minimum":0},"duration_minutes":{"type":["integer","null"],"minimum":0},"content":{"type":["string","null"],"maxLength":50000},"description":{"type":["string","null"],"maxLength":2000,"description":"Optional learner-facing summary, shown on Link lessons."},"content_storage_path":{"type":["string","null"],"maxLength":1024,"description":"When non-null, this must be a course-files object key under the calling account and lesson course. Managed video assets must be attached with video_asset_id."},"scorm_identifier":{"type":["string","null"],"maxLength":255},"drip_enabled":{"type":"boolean"},"drip_type":{"type":["string","null"],"enum":["days_after_enrollment","fixed_date"]},"drip_days_after_enrollment":{"type":["integer","null"],"minimum":0},"drip_fixed_date":{"type":["string","null"]},"drip_teaser":{"type":["string","null"],"maxLength":2000}}},{"type":"object","properties":{"video_asset_id":{"type":"string","format":"uuid"}},"required":["video_asset_id"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Lesson updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LessonRow"}},"required":["success","data"]}}}},"404":{"description":"Lesson not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Video asset cannot be attached to this lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Lesson update or managed attachment body is invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["LMS"],"summary":"Delete a lesson","description":"Hard-delete a lesson. Progress rows cascade. Requires `lms.lessons.delete` scope.","security":[{"apiKey":["lms.lessons.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Lesson deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/DeletedResult"}},"required":["success","data"]}}}},"404":{"description":"Lesson not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/lms/courses/{id}/lessons/reorder":{"patch":{"tags":["LMS"],"summary":"Atomically reorder lessons within a course","description":"Rewrites the `order_index` of every supplied lesson inside a single Postgres transaction via the `lms_reorder_lessons` function. All-or-nothing: a mismatch on any lesson id rejects the entire batch. Requires `lms.lessons.reorder` scope.","security":[{"apiKey":["lms.lessons.reorder"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"positions":{"type":"array","items":{"type":"object","properties":{"lesson_id":{"type":"string","format":"uuid"},"order":{"type":"integer","minimum":0}},"required":["lesson_id","order"]},"minItems":1,"maxItems":500}},"required":["positions"]}}}},"responses":{"200":{"description":"Lessons reordered","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ReorderedResult"}},"required":["success","data"]}}}},"400":{"description":"Validation failed or lesson id mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Course not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/threads":{"post":{"tags":["Loop"],"summary":"Create a thread in a channel","description":"Address the channel with `channel` (its slug or its id) or with the original `channel_id` (id only). Supply exactly one of the two: a body carrying both, or neither, is rejected with 400. `channel_id` is not deprecated and remains supported. A slug that names a secret channel is not resolvable; address a secret channel by id.","security":[{"apiKey":["loop.threads.manage"],"userBearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"type":"string","minLength":1,"maxLength":255},"channel_id":{"type":"string","format":"uuid"},"title":{"type":"string","minLength":1,"maxLength":200},"content":{"type":"string","minLength":1},"external_type":{"type":"string","maxLength":100},"external_id":{"type":"string","maxLength":255}},"required":["title","content"]}}}},"responses":{"201":{"description":"Thread created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"thread_id":{"type":"string","format":"uuid"},"channel_id":{"type":"string","format":"uuid"},"url":{"type":"string"},"created_at":{"type":"string","format":"date-time"}},"required":["thread_id","channel_id","url","created_at"]}},"required":["success","data"]}}}},"404":{"description":"Channel not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/threads/{id}":{"get":{"tags":["Loop"],"summary":"Get a thread by id","description":"Cross-account access returns 404 rather than 403 to avoid leaking thread ids. A thread in a private or secret channel additionally requires a member bearer token (`Authorization: Bearer <jwt>`) alongside the API key: an unattended caller or a non-member bearer gets the identical 404 as a non-existent thread.","security":[{"apiKey":["loop.threads.browse"]},{"apiKey":["loop.threads.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Thread retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopThread"}},"required":["success","data"]}}}},"404":{"description":"Thread not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["Loop"],"summary":"Update a thread","description":"Edit a thread parent message. `content` changes are author-only. `is_pinned` and `is_featured` changes require the caller to hold the `owner`, `admin` or `moderator` role on the thread's channel; being the author grants no pin or feature right. A request that combines `content` with a flag is refused as a whole when the caller is not the author. Requires `loop.threads.update` scope.","security":[{"apiKey":["loop.threads.update"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":10000},"is_pinned":{"type":"boolean"},"is_featured":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Thread updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopUpdatedResult"}},"required":["success","data"]}}}},"403":{"description":"Forbidden: a `content` change by a caller who is not the author, or a pin or feature change by a caller who holds no `owner`, `admin` or `moderator` role on the thread's channel (code `FORBIDDEN`); or the API key lacks the `loop.threads.update` scope (code `INSUFFICIENT_SCOPES`). Nothing is written","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Thread not found, including a thread that belongs to another account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Loop"],"summary":"Delete a thread","description":"Soft-delete a thread parent message. The author may delete an ordinary thread, as may a caller holding the `owner`, `admin` or `moderator` role on the thread's channel. A system thread root (one carrying a `system_event`) cannot be deleted by anyone. Replies cascade via the existing `messages` cascade trigger. Requires `loop.threads.delete` scope.","security":[{"apiKey":["loop.threads.delete"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Thread deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopDeletedResult"}},"required":["success","data"]}}}},"403":{"description":"Forbidden: the thread is a system thread root, or the caller is neither the author nor holds the `owner`, `admin` or `moderator` role on the thread's channel (code `FORBIDDEN`); or the API key lacks the `loop.threads.delete` scope (code `INSUFFICIENT_SCOPES`). Nothing is written","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Thread not found, including a thread that belongs to another account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/threads/{id}/activity":{"get":{"tags":["Loop"],"summary":"Get reply, participant, and contributor activity for a thread","description":"Subject to the same private/secret channel membership gate as the thread detail endpoint: an unattended caller or a non-member bearer gets the identical 404 as a non-existent thread.","security":[{"apiKey":["loop.threads.browse"]},{"apiKey":["loop.threads.browse"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Activity retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopThreadActivity"}},"required":["success","data"]}}}},"404":{"description":"Thread not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/bots":{"get":{"tags":["Loop"],"summary":"List bots for the calling account","security":[{"apiKey":["loop.bots.browse"]}],"responses":{"200":{"description":"Bots retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopBotsList"}},"required":["success","data"]}}}}}},"post":{"tags":["Loop"],"summary":"Create a bot","security":[{"apiKey":["loop.bots.manage"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"avatar_url":{"type":"string","format":"uri"},"description":{"type":"string","maxLength":500},"type":{"type":"string","enum":["course_assistant","sponsor","notification","integration","custom"],"default":"custom"},"metadata":{"type":"object","additionalProperties":{}}},"required":["name"]}}}},"responses":{"201":{"description":"Bot created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopBot"}},"required":["success","data"]}}}}}}},"/v1/loop/bots/{id}":{"get":{"tags":["Loop"],"summary":"Get a bot by id","security":[{"apiKey":["loop.bots.browse"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Bot retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopBot"}},"required":["success","data"]}}}},"404":{"description":"Bot not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["Loop"],"summary":"Update a bot","description":"Edit bot fields (name, description, avatar_url, is_active). Account-scoped. Requires `loop.bots.update` scope.","security":[{"apiKey":["loop.bots.update"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":["string","null"],"maxLength":2000},"avatar_url":{"type":["string","null"],"maxLength":2048,"format":"uri"},"is_active":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Bot updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopBot"}},"required":["success","data"]}}}},"404":{"description":"Bot not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Loop"],"summary":"Delete a bot","description":"Hard-delete a bot. `messages.bot_id` references SET NULL via foreign key. Requires `loop.bots.delete` scope.","security":[{"apiKey":["loop.bots.delete"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Bot deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopDeletedResult"}},"required":["success","data"]}}}},"404":{"description":"Bot not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/bots/messages":{"post":{"tags":["Loop"],"summary":"Send a bot message into a channel","description":"Authored as the system user with `bot_id` carrying the display identity. Parent must live in the same channel for replies. Address the channel with `channel` (its slug or its id) or with the original `channel_id` (id only). Supply exactly one of the two: a body carrying both, or neither, is rejected with 400. `channel_id` is not deprecated and remains supported. A slug that names a secret channel is not resolvable; address a secret channel by id.","security":[{"apiKey":["loop.bots.manage"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"type":"string","minLength":1,"maxLength":255},"channel_id":{"type":"string","format":"uuid"},"bot_id":{"type":"string","format":"uuid"},"content":{"type":"string","minLength":1,"maxLength":10000},"content_html":{"type":"string","maxLength":50000},"parent_id":{"type":"string","format":"uuid"},"metadata":{"type":"object","additionalProperties":{}}},"required":["bot_id","content"]}}}},"responses":{"201":{"description":"Message created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopBotMessage"}},"required":["success","data"]}}}},"404":{"description":"Bot, channel, or parent message not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/me/mentions":{"get":{"tags":["Loop"],"summary":"List mentions for the authenticated user","description":"Returns messages mentioning the @display_name of the Loop user linked to the CRM contact for the authenticated user. Identity is derived exclusively from the bearer JWT (`Authorization: Bearer <jwt>`); no `contact_id` parameter is accepted.","security":[{"apiKey":["loop.activity.read"],"userBearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":["string","null"]},"required":false,"name":"since","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"channel","in":"query"}],"responses":{"200":{"description":"Mentions retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopMentions"}},"required":["success","data"]}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact or linked Loop user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/me/channels":{"get":{"tags":["Loop"],"summary":"List Loop channels the authenticated user belongs to","description":"Returns the channels the user identified by the bearer token is a member of, scoped to the calling account. Each item carries the caller's `role` on that channel: `owner`, `admin`, `moderator` or `member`. Identity is derived exclusively from the bearer JWT (`Authorization: Bearer <jwt>`); no `contact_id` or `user_id` parameter is accepted.","security":[{"apiKey":["loop.channels.browse"],"userBearer":[]}],"responses":{"200":{"description":"Channels retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyChannelsResponse"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated user is not a member of the API key's account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/channels":{"get":{"tags":["Loop"],"summary":"List the account's Loop channels","description":"Requires `loop.channels.browse`. No bearer token is needed, so an unattended integration can resolve a channel by name and obtain the id the write endpoints accept. Returns public channels by default; pass `privacy=private` or `privacy=all` to include private channels, which additionally requires the elevated `loop.channels.manage` scope. Secret channels are never returned.","security":[{"apiKey":["loop.channels.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"search","in":"query"},{"schema":{"type":"string","enum":["public","private","all"],"default":"public"},"required":false,"name":"privacy","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":false},"required":false,"name":"includeArchived","in":"query"}],"responses":{"200":{"description":"Channels retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/LoopChannelListItem"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Private channels requested without the `loop.channels.manage` scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/channels/{channelId}/stats":{"get":{"tags":["Loop"],"summary":"Get engagement stats for a channel","description":"Requires `loop.channels.stats.read` scope. The channel is addressed by its slug or its id. Returns all-time and current-calendar-month (UTC) engagement windows for the channel. All 8 reaction type keys are always present with explicit zeros. Comments = threads (top-level messages with at least one reply) plus replies; deleted messages and their reactions are excluded. An unknown address, a cross-account one, and a secret channel addressed by slug all return 404 rather than 403, so the response cannot confirm a channel exists on another account. A secret channel remains addressable by id.","security":[{"apiKey":["loop.channels.stats.read"]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Channel slug or channel UUID"},"required":true,"description":"Channel slug or channel UUID","name":"channelId","in":"path"}],"responses":{"200":{"description":"Stats retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopChannelStats"}},"required":["success","data"]},"example":{"success":true,"data":{"channel_id":"3f9c2b1a-4d5e-4f6a-8b7c-9d0e1f2a3b4c","channel_slug":"general","all_time":{"messages":{"total":482},"comments":{"total":210,"threads":64,"replies":146},"reactions":{"total":138,"by_type":{"thumbs_up":52,"heart":31,"joy":18,"open_mouth":6,"slightly_frowning_face":2,"tada":15,"eyes":9,"pray":5}}},"current_month":{"messages":{"total":47},"comments":{"total":22,"threads":8,"replies":14},"reactions":{"total":19,"by_type":{"thumbs_up":7,"heart":4,"joy":3,"open_mouth":1,"slightly_frowning_face":1,"tada":2,"eyes":1,"pray":0}}}}}}}},"400":{"description":"Channel id is not a valid UUID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Caller's account does not hold the required scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Channel not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/activity/mentions":{"get":{"tags":["Loop"],"deprecated":true,"summary":"List mentions of a CRM contact across the account (deprecated)","description":"DEPRECATED, removable on or after 2026-11-30. Use `GET /v1/loop/me/mentions`, which takes the same `limit`, `since`, and `channel` parameters and returns the same payload, but derives the member from the bearer token. `contact_id` is identity by assertion: any holder of a key with `loop.activity.read` can read any member’s mentions. Every response from this operation carries `Deprecation`, `Sunset`, and a `Link` header naming the successor. Behaviour is otherwise unchanged for the window. Resolves the contact to its linked Loop user and returns messages mentioning `@display_name` across the account's non-secret channels.","security":[{"apiKey":["loop.activity.read"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"contact_id","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":["string","null"]},"required":false,"name":"since","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"channel","in":"query"}],"responses":{"200":{"description":"Mentions retrieved","headers":{"Deprecation":{"schema":{"type":"string","example":"true"},"description":"Always `true` for this operation (RFC 8594)."},"Sunset":{"schema":{"type":"string","example":"Sat, 30 Nov 2026 00:00:00 GMT"},"description":"Earliest date this operation may be removed."},"Link":{"schema":{"type":"string","example":"</v1/loop/me/mentions>; rel=\"successor-version\""},"description":"Names the replacement operation."}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopMentions"}},"required":["success","data"]}}}},"404":{"description":"Contact or linked user not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/users/{id}/activity":{"get":{"tags":["Loop"],"summary":"Get a user's activity stats and recent messages","security":[{"apiKey":["loop.activity.read"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":50,"default":10},"required":false,"name":"limit","in":"query"},{"schema":{"type":["string","null"]},"required":false,"name":"since","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":false},"required":false,"name":"statsOnly","in":"query"}],"responses":{"200":{"description":"Activity retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopUserActivity"}},"required":["success","data"]}}}},"404":{"description":"User not a member of the account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/users/{id}/notifications":{"get":{"tags":["Loop"],"summary":"Get account notifications","description":"The feed returns the organisation's team notifications only when the target user is staff on it; a target with the `contact` role receives an empty page. Personal notifications are never returned by this API-key route; use `/v1/loop/users/me/notifications` with the user's bearer for those.","security":[{"apiKey":["loop.activity.read"]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":["integer","null"],"minimum":0,"default":0},"required":false,"name":"offset","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":false},"required":false,"name":"unread_only","in":"query"}],"responses":{"200":{"description":"Notifications retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopUserNotifications"}},"required":["success","data"]}}}}}}},"/v1/loop/users/me/activity":{"get":{"tags":["Loop"],"summary":"Get the authenticated user's activity stats and recent messages","description":"Identity is derived exclusively from the bearer JWT (`Authorization: Bearer <jwt>`); no `user_id` parameter is accepted.","security":[{"apiKey":["loop.activity.read"],"userBearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":50,"default":10},"required":false,"name":"limit","in":"query"},{"schema":{"type":["string","null"]},"required":false,"name":"since","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":false},"required":false,"name":"statsOnly","in":"query"}],"responses":{"200":{"description":"Activity retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopUserActivity"}},"required":["success","data"]}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/users/me/notifications":{"get":{"tags":["Loop"],"summary":"Get the authenticated user's notifications","description":"Identity is derived exclusively from the bearer JWT (`Authorization: Bearer <jwt>`). The feed returns the caller’s personal notifications, plus the organisation’s team notifications only when the caller is staff on it; a member with the `contact` role receives personal notifications only.","security":[{"apiKey":["loop.activity.read"],"userBearer":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":["integer","null"],"minimum":0,"default":0},"required":false,"name":"offset","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string"}],"default":false},"required":false,"name":"unread_only","in":"query"}],"responses":{"200":{"description":"Notifications retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopUserNotifications"}},"required":["success","data"]}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/public/activity":{"get":{"tags":["Loop"],"summary":"List recent activity from the account's public channels","description":"API-key gated under `loop.activity.read`. \"Public\" refers to public channels within the account; account is derived from `auth.context.accountId`. Pass `channel_slug` to scope the feed to a single public channel (e.g. an event-specific channel); omit it to aggregate across all public channels.","security":[{"apiKey":["loop.activity.read"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":255},"required":false,"name":"channel_slug","in":"query"}],"responses":{"200":{"description":"Activity retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopPublicActivity"}},"required":["success","data"]}}}}}}},"/v1/loop/public/announcements":{"get":{"tags":["Loop"],"summary":"List announcements from the account's public channels","description":"API-key gated under `loop.activity.read`. \"Public\" refers to public channels within the account; account is derived from `auth.context.accountId`.","security":[{"apiKey":["loop.activity.read"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Announcements retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopPublicAnnouncements"}},"required":["success","data"]}}}}}}},"/v1/loop/public/blocks/discovery":{"get":{"tags":["Loop"],"summary":"List Loop frontend block types","description":"API-key gated under `loop.threads.browse`. Returns the static catalogue of Loop block types available for embedding (community-feed, announcements).","security":[{"apiKey":["loop.threads.browse"]}],"responses":{"200":{"description":"Block catalogue","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopBlocksDiscovery"}},"required":["success","data"]}}}}}}},"/v1/loop/threads/{id}/messages":{"post":{"tags":["Loop"],"summary":"Reply to a thread","description":"Post a reply to a thread. Requires `loop.messages.create` scope and a user-id-bearing caller. `author_id` is server-derived from `auth.context.userId`.","security":[{"apiKey":["loop.messages.create"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":10000}},"required":["content"]}}}},"responses":{"201":{"description":"Message created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopMessage"}},"required":["success","data"]}}}},"404":{"description":"Thread not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/messages/{id}":{"patch":{"tags":["Loop"],"summary":"Edit a message (author-only)","description":"Update the content of a message the caller authored. Sets `is_edited = true`. Requires `loop.messages.update` scope.","security":[{"apiKey":["loop.messages.update"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":10000}},"required":["content"]}}}},"responses":{"200":{"description":"Message updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopMessage"}},"required":["success","data"]}}}},"404":{"description":"Message not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Loop"],"summary":"Delete a message (author or channel moderator)","description":"Soft-delete a message. Callers with `loop.messages.delete.admin` scope take the moderation path which bypasses the author check but performs a runtime role lookup against `channel_memberships.role`, admitting `owner`, `admin` and `moderator`. Callers with only `loop.messages.delete` take the author-only path. Both paths overwrite the message content, so a deleted message retains no readable content. Neither path can delete a system message: a message carrying a `system_event` is refused with 403 on both paths, and that check runs before the author check and before the moderation-role lookup. The moderation path response carries `originalAuthorId` and `channelId` for audit trail.","security":[{"apiKey":["loop.messages.delete"],"userBearer":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Message deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"anyOf":[{"$ref":"#/components/schemas/LoopDeletedResult"},{"$ref":"#/components/schemas/LoopAdminDeletedResult"}]}},"required":["success","data"]}}}},"403":{"description":"Forbidden: the target message carries a `system_event` and cannot be deleted on either path; or, on the author-only path, the caller is not the author; or, on the moderation path, the caller holds no channel moderation role","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Message not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/integration/users/sync":{"post":{"tags":["Loop"],"summary":"Sync a WordPress user into Loop","description":"Resolves the Loop user by WordPress id then email, applies wp roles and role-based channel membership. Requires `loop.users.sync`. The user must already exist in Loop (provisioned via SSO), otherwise 404.","security":[{"apiKey":["loop.users.sync"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"external_id":{"type":"integer","exclusiveMinimum":0},"email":{"type":"string","format":"email"},"display_name":{"type":"string","maxLength":255},"first_name":{"type":"string","maxLength":255},"last_name":{"type":"string","maxLength":255},"avatar_url":{"type":"string","maxLength":2048,"format":"uri"},"roles":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100},"default":[]},"idp_entity_id":{"type":"string","minLength":1,"maxLength":2048}},"required":["external_id","email","idp_entity_id"]}}}},"responses":{"200":{"description":"User synced","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopSyncedUser"}},"required":["success","data"]}}}},"400":{"description":"idp_entity_id does not match an active SSO connection on the account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No Loop user for the WordPress id or email","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/integration/users/bulk-sync":{"post":{"tags":["Loop"],"summary":"Bulk-sync up to 100 WordPress users into Loop","description":"Resolves and syncs each user independently. Unresolved users are reported as failed, not fatal. Requires `loop.users.sync`.","security":[{"apiKey":["loop.users.sync"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"idp_entity_id":{"type":"string","minLength":1,"maxLength":2048},"users":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"integer","exclusiveMinimum":0},"email":{"type":"string","format":"email"},"display_name":{"type":"string","maxLength":255},"first_name":{"type":"string","maxLength":255},"last_name":{"type":"string","maxLength":255},"avatar_url":{"type":"string","maxLength":2048,"format":"uri"},"roles":{"type":"array","items":{"type":"string","minLength":1,"maxLength":100},"default":[]}},"required":["external_id","email"]},"minItems":1,"maxItems":100}},"required":["idp_entity_id","users"]}}}},"responses":{"200":{"description":"Bulk sync result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopBulkSyncResult"}},"required":["success","data"]}}}},"400":{"description":"idp_entity_id does not match an active SSO connection on the account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/integration/committees":{"get":{"tags":["Loop"],"summary":"List synced committee channels","security":[{"apiKey":["loop.committees.browse"]}],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"required":false,"name":"page","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Committees retrieved. Each item includes `slug`, the Loop channel slug a website can link to directly; the `loop-committee/{uniqueId}` SSO shareable link resolves the same channel from the Upbeat unique id.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/LoopCommitteeListItem"}},"meta":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["pagination"]}},"required":["success","data"]}}}}}},"post":{"tags":["Loop"],"summary":"Create or update a committee channel (idempotent on unique_id)","description":"Upsert a committee as a private channel keyed by `unique_id`. When `roster` is present it supersedes chair/secretary/member and supports multiple owners and moderators. `mode` applies to the roster and defaults to `merge`. `merge` adds and promotes members and never removes anyone. `replace` also removes the members this integration added that the roster no longer lists: a member added any other way (manually, by a role-based auto-join, as the channel creator, or before this behaviour existed) is never removed or demoted, only promoted when the roster gives a higher role, and the last owner is never removed or demoted. An empty `roster` with `replace` removes every member this integration added. A roster entry that does not resolve to a Loop user is skipped and reported in `skipped_external_ids`, and its member is kept. `adopt_external_ids` names roster members whose existing, unmanaged membership the sync should take over; it is read only when a roster is applied, and nothing is ever adopted implicitly. Only a member on the roster of the same request can be adopted, and only through the SSO identity of the connection: an entry that matched a member by email is never adopted, and a named id that maps to more than one member adopts nothing, so both report `unresolved`. A membership already managed by an active CRM group grant or by Upbeat committee provenance is refused. An adopted membership then follows the roster like one this integration added, including demotion and, in `replace` mode, removal, with the last owner and last administrator still protected. Adoption posts no message and changes no role by itself. A request that names any member also requires `loop.committees.update`; without it the request is refused with 403 and nothing is written. A Loop organisation administrator can remove a member of a synced committee channel, or lower their role, in an emergency, which places a hold the sync honours until the administrator lifts it. An entry for a removal-held member is skipped whole: the member is not added, promoted, demoted or adopted, is not counted in `applied`, and is not removed by `replace`; a named id for them reports `held`. An entry for a role-capped member is applied at the cap when the roster role ranks above it, so the sync never raises that member above the cap and may still lower them; a role-capped member can be adopted and is then capped. Once the administrator lifts the hold, the next sync treats the member like any other roster entry and adds them back as a managed member if the roster still lists them. The legacy `chair_external_id`, `secretary_external_id` and `member_external_ids` fields, used when no roster is applied, honour the same holds: a removal-held user is not added, a held chair leaves the current owner in place, and a role-capped user is written at no more than the cap. The response reports `applied`, `skipped`, `removed` and `skipped_external_ids`, `adopted` and `adoption_results` (one outcome per distinct named id that has an outcome), and `held` (every resolved roster entry a hold changed, with the kind, cap, reason and start time of the hold, so the site can explain why a member is missing or capped), which are zero and empty when no roster path ran. Requires `loop.committees.create`, plus `loop.committees.update` when `adopt_external_ids` is not empty.","security":[{"apiKey":["loop.committees.create"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"idp_entity_id":{"type":"string","minLength":1,"maxLength":2048},"unique_id":{"type":"string","minLength":1,"maxLength":255},"name":{"type":"string","minLength":1,"maxLength":255},"parent_unique_id":{"type":"string","maxLength":255},"roster":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"integer","exclusiveMinimum":0},"channel_role":{"type":"string","enum":["owner","moderator","member"]},"committee_role_label":{"type":"string","maxLength":100},"email":{"type":"string","format":"email"}},"required":["external_id","channel_role"]},"maxItems":2000},"mode":{"type":"string","enum":["merge","replace"],"default":"merge"},"adopt_external_ids":{"type":"array","items":{"type":"integer","exclusiveMinimum":0},"maxItems":2000,"default":[],"description":"Roster members (by external_id) whose existing, unmanaged channel membership the sync should take over. Read only when a roster is applied. Only a member whose roster entry matches the SSO identity of the connection is adopted, never one found by email. A member whose removal an administrator placed on hold reports `held` and is not adopted. A non-empty list also requires the `loop.committees.update` scope."},"chair_external_id":{"type":"integer","exclusiveMinimum":0},"secretary_external_id":{"type":"integer","exclusiveMinimum":0},"member_external_ids":{"type":"array","items":{"type":"integer","exclusiveMinimum":0},"maxItems":2000},"color":{"type":"string","maxLength":32},"is_active":{"type":"boolean","default":true}},"required":["idp_entity_id","unique_id","name"]}}}},"responses":{"200":{"description":"Committee synced","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopCommitteeSyncResult"}},"required":["success","data"]}}}},"400":{"description":"idp_entity_id does not match an active SSO connection on the account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"adopt_external_ids is not empty and the key lacks the loop.committees.update scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/integration/committees/member-refresh":{"post":{"tags":["Loop"],"summary":"Request a background Upbeat committee membership refresh","description":"Requires Loop, not CRM. Accepts only a membership number and source; membership is read from Upbeat. Always returns accepted, including for unknown members. Requires loop.committees.sync, explicitly granted to the integration key.","security":[{"apiKey":["loop.committees.sync"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["upbeat"]},"externalContactId":{"type":"string","minLength":1,"maxLength":100}},"required":["source","externalContactId"],"additionalProperties":false}}}},"responses":{"202":{"description":"Refresh accepted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopMemberRefreshAccepted"}},"required":["success","data"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"API key required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Loop entitlement and loop.committees.sync scope required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/integration/members/channels":{"get":{"tags":["Loop"],"summary":"Ask whether a member, named by contact pair, is in an active channel","description":"For a connected site that holds no member bearer token. Returns `in_active_channel`, true when the member holds a membership of a channel in the organisation that is not archived and not a direct message, and `resolved`, false when the pair names no user who belongs to the organisation (the member has never signed in to Agend). The member is found through the contact holding the pair and, for an `upbeat-contacts` pair, through a trusted SSO identity on a membership-number connection; never by email. A pair nobody holds is answered `false`, not an error. No channel, count or other member is returned. Requires the `loop.memberships.read` scope, granted to no key by default, and no user bearer token. Errors: `400` `VALIDATION_ERROR` naming the field; `403` `SOURCE_NOT_ALLOWED` or `INSUFFICIENT_SCOPES`; `429`.","security":[{"apiKey":["loop.memberships.read"]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100,"description":"The contact's source, for example `upbeat-contacts` for an Upbeat site. Must be one of the API key's allowed contact sources."},"required":true,"name":"external_source","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"The contact's id in that source, for example the membership number."},"required":true,"name":"external_id","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"The member's channel presence","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopMemberChannelPresence"}},"required":["success","data"]}}}},"400":{"description":"`VALIDATION_ERROR` naming the field","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"API key required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"`SOURCE_NOT_ALLOWED` when the key does not list `external_source`, or `INSUFFICIENT_SCOPES`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/integration/committees/{uniqueId}":{"get":{"tags":["Loop"],"summary":"Get a committee channel by unique id","security":[{"apiKey":["loop.committees.browse"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"uniqueId","in":"path"}],"responses":{"200":{"description":"Committee retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopCommittee"}},"required":["success","data"]}}}},"404":{"description":"Committee not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Loop"],"summary":"Archive a committee channel","security":[{"apiKey":["loop.committees.delete"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"uniqueId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"visibility":{"type":"string","enum":["hidden","readonly"],"default":"hidden"}}}}}},"responses":{"200":{"description":"Committee archived","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopCommitteeArchivedResult"}},"required":["success","data"]}}}},"404":{"description":"Committee not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/integration/committees/{uniqueId}/members":{"get":{"tags":["Loop"],"summary":"Report the role and management state of each committee member","description":"Lists the members of a committee channel by the external id the SSO connection of the site knows them by (`idp_entity_id`), each with their channel `role` and `managed_by`, what manages the membership. `managed_by` is `wordpress_sync` (the WordPress sync inserted or adopted the membership), `group` (an active CRM group grant backs the channel and user), `upbeat` (Upbeat committee provenance backs the membership) or `none`; when more than one applies, the first in that order is reported. Use it to choose members to name in `adopt_external_ids` on `POST /v1/loop/integration/committees`, and to see what the roster would do to them. A member with no usable identity on the connection is counted in `unlinked_count` and never listed, and the response carries no name, email, avatar or Loop user id. `holds` lists the active emergency holds on the channel (`kind` of `removal` or `role_cap`, the `role_cap`, the `reason` and `held_since`) for users with an identity on the connection, including a removal-held user who is no longer a member, so the site can show why someone is not in the channel or is capped; a hold the administrator has lifted is not listed. It names private committee members, so it requires a `unified` API key holding `loop.committees.update`, not the browse scope; any other key is refused with 403 before anything is read.","security":[{"apiKey":["loop.committees.update"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"uniqueId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":2048},"required":true,"name":"idp_entity_id","in":"query"}],"responses":{"200":{"description":"Committee members retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopCommitteeMembers"}},"required":["success","data"]}}}},"400":{"description":"idp_entity_id is missing, or does not match an active SSO connection on the account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The key is not a unified key holding the loop.committees.update scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Committee not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/loop/integration/committees/{uniqueId}/moderator":{"patch":{"tags":["Loop"],"summary":"Set a committee chair or secretary","description":"Set the committee owner (chair) or moderator (secretary) to the given WordPress user. Requires `loop.committees.update`.","security":[{"apiKey":["loop.committees.update"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"uniqueId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"idp_entity_id":{"type":"string","minLength":1,"maxLength":2048},"role":{"type":"string","enum":["chair","secretary"]},"external_user_id":{"type":"integer","exclusiveMinimum":0}},"required":["idp_entity_id","role","external_user_id"]}}}},"responses":{"200":{"description":"Moderator updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/LoopModeratorUpdatedResult"}},"required":["success","data"]}}}},"400":{"description":"idp_entity_id does not match an active SSO connection on the account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Committee not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/sites/config":{"get":{"tags":["Sites"],"summary":"Get the published site config for the connected account","description":"Returns a safe subset of the API key account's published site config: the owning `account.slug`, brand identity, theme fonts and colours, the enabled-apps map, the `commerce` and `content` capability blocks, and the resolved `links` block. Widgets inherit brand styling from this and hide themselves when their app is disabled. `account.slug` is the owning organisation slug, published so a connected site can compare the tenant its gateway credential resolves against the tenant whose presentation it renders; the internal account UUID is deliberately not exposed. `commerce.cart.checkout_mode` and `content.wordpress.mode` are null unless the account has an explicitly documented mode configured, so an unrecognised stored value fails closed rather than being published. `theme.colors` carries only entries whose key is lowercase kebab-case and whose value matches the legacy 3–8 digit hex or bare H S% L% filter (including historical five- and seven-digit hex). This filter is not modern palette validation. Heading and body fonts retain arbitrary nonempty stored strings; missing or empty font strings become null. `links.portal` is the resolved member-portal origin for the account (for example `https://portal.agend.com.au`, or the account's active custom portal hostname) — origin only, carrying no token, no identifier, and no member-specific path, so a theme can render a static Member Access link without hard-coding a URL per deployment. Authenticated hand-off still uses the URL returned by `POST /v1/auth/session-handoff`. Returns 404 when the account has no published site config. Requires `sites.config.browse` scope.","security":[{"apiKey":["sites.config.browse"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"responses":{"200":{"description":"Published site config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteConfigResponse"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No published site config for this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/sso/connections":{"get":{"tags":["SSO"],"summary":"List SSO connections","description":"Lists the SAML SSO connections for the API key account. The IdP certificate is returned masked, and approval_state reports whether Agend has approved each connection for use. Requires the sso.connections.browse scope.","security":[{"apiKey":["sso.connections.browse"]}],"responses":{"200":{"description":"Connections retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoConnectionList"}}}},"401":{"description":"Missing or invalid API key, or insufficient scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["SSO"],"summary":"Create an SSO connection","description":"Creates a SAML SSO connection for the API key account. SP fields are derived server-side. Agend reviews each connection before it can be used: a connection is stored inactive with approval_state pending until Agend approves it, and is_active: true is stored as false while it is pending. A change to the protocol, issuer (idp_entity_id), signing certificate, sign-in URL (idp_sso_url) or allowed_domains of an approved connection returns it to pending and inactive. A role_mapping entry or default_role may name any role, including owner. A role that can administer the account applies only after the person confirms by email once; every other role links them silently. Requires the sso.connections.create scope.","security":[{"apiKey":["sso.connections.create"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"slug":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"default_landing_path":{"type":"string","pattern":"^\\/[^\\s\\\\]*$"},"idp_entity_id":{"type":"string","minLength":1},"idp_sso_url":{"type":"string","format":"uri"},"idp_certificate":{"type":"string","minLength":1},"name_id_format":{"type":"string","minLength":1},"attribute_mappings":{"type":"object","properties":{"email_attribute":{"type":"string","minLength":1,"default":"email"},"first_name_attribute":{"type":"string","minLength":1},"last_name_attribute":{"type":"string","minLength":1},"display_name_attribute":{"type":"string","minLength":1},"groups_attribute":{"type":"string","minLength":1},"role_attribute":{"type":"string","minLength":1},"role_mapping":{"type":"object","additionalProperties":{"type":"string"}}}},"allowed_domains":{"type":"array","items":{"type":"string","minLength":1}},"default_role":{"type":"string","minLength":1},"jit_provisioning":{"type":"boolean","default":true},"jit_contact_provisioning":{"type":"boolean","default":true},"is_active":{"type":"boolean","default":false},"post_link_return_url":{"type":"string"},"sign_authn_requests":{"type":"boolean","default":false},"want_assertions_signed":{"type":"boolean","default":true},"allow_idp_initiated":{"type":"boolean","default":false}},"required":["name","slug","idp_entity_id","idp_sso_url","idp_certificate"]}}}},"responses":{"201":{"description":"Connection created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoConnectionCreated"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or insufficient scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/sso/connections/{id}":{"get":{"tags":["SSO"],"summary":"Get an SSO connection","description":"Requires the sso.connections.browse scope.","security":[{"apiKey":["sso.connections.browse"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Connection retrieved","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SsoConnection"},{"properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SsoConnection"}},"required":["success","data"]}]}}}},"401":{"description":"Missing or invalid API key, or insufficient scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Connection not found in the API key account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["SSO"],"summary":"Update an SSO connection","description":"Updates a SAML SSO connection. Omit idp_certificate to keep the stored value. Sessions minted through a connection are confined to the account it authenticated for. Only Agend staff can relax that, so it cannot be set through this API. Agend reviews each connection before it can be used: a connection is stored inactive with approval_state pending until Agend approves it, and is_active: true is stored as false while it is pending. A change to the protocol, issuer (idp_entity_id), signing certificate, sign-in URL (idp_sso_url) or allowed_domains of an approved connection returns it to pending and inactive. A role_mapping entry or default_role may name any role, including owner. A role that can administer the account applies only after the person confirms by email once; every other role links them silently. Requires the sso.connections.update scope.","security":[{"apiKey":["sso.connections.update"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"slug":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"default_landing_path":{"type":"string","pattern":"^\\/[^\\s\\\\]*$"},"idp_entity_id":{"type":"string","minLength":1},"idp_sso_url":{"type":"string","format":"uri"},"idp_certificate":{"type":"string","minLength":1},"name_id_format":{"type":"string","minLength":1},"attribute_mappings":{"type":"object","properties":{"email_attribute":{"type":"string","minLength":1,"default":"email"},"first_name_attribute":{"type":"string","minLength":1},"last_name_attribute":{"type":"string","minLength":1},"display_name_attribute":{"type":"string","minLength":1},"groups_attribute":{"type":"string","minLength":1},"role_attribute":{"type":"string","minLength":1},"role_mapping":{"type":"object","additionalProperties":{"type":"string"}}}},"allowed_domains":{"type":"array","items":{"type":"string","minLength":1}},"default_role":{"type":"string","minLength":1},"jit_provisioning":{"type":"boolean","default":true},"jit_contact_provisioning":{"type":"boolean","default":true},"is_active":{"type":"boolean","default":false},"post_link_return_url":{"type":"string"},"sign_authn_requests":{"type":"boolean","default":false},"want_assertions_signed":{"type":"boolean","default":true},"allow_idp_initiated":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"Connection updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoConnectionUpdated"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or insufficient scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Connection not found in the API key account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["SSO"],"summary":"Delete an SSO connection","description":"Requires the sso.connections.delete scope.","security":[{"apiKey":["sso.connections.delete"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Connection deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoConnectionDeleted"}}}},"401":{"description":"Missing or invalid API key, or insufficient scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Connection not found in the API key account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/sso/identities/status":{"get":{"tags":["SSO"],"summary":"Check whether an external identity is linked","description":"Reports whether an external member, identified by idpEntityId + externalId, is already linked to a member on the API key account. Mints nothing and never provisions; an unlinked identity, or a link that is not proven (recorded before linking authority was recorded, or demoted since), returns { linked: false }, because no session can be minted from it. When linked, also returns the resolved user_id and the bound CRM contact_id (null if none is bound). Requires the sso.identities.read scope.","security":[{"apiKey":["sso.identities.read"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"idpEntityId","in":"query"},{"schema":{"type":"string"},"required":true,"name":"externalId","in":"query"}],"responses":{"200":{"description":"Link status resolved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoIdentityLinkStatus"}}}},"400":{"description":"Validation failed, or no SSO connection matches the issuer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or insufficient scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/sso/tokens":{"post":{"tags":["SSO"],"summary":"Mint an access token for an external member","description":"Mints a short-lived Supabase access token for a member already linked via SSO, identified by idp_entity_id + external_id. The member must be synced first, and the link proven: a link recorded before linking authority was recorded, or demoted since, mints nothing and is answered as an unlinked member. This endpoint never provisions, and no refresh token is returned. The response also carries the bound CRM contact_id (null if none is bound). Requires the sso.tokens.create scope.","security":[{"apiKey":["sso.tokens.create"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"idp_entity_id":{"type":"string","minLength":1,"maxLength":2048},"external_id":{"type":"string","minLength":1,"maxLength":255}},"required":["idp_entity_id","external_id"],"additionalProperties":false}}}},"responses":{"201":{"description":"Access token minted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/SsoMintedToken"}},"required":["success","data"]}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or insufficient scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No SSO connection matches the issuer, or the external member is not linked (sync the member first)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"RATE_LIMIT_EXCEEDED. Two limits apply: 60 mints a minute per API key, and 6 mints a minute per linked visitor (the same idp_entity_id and external_id) per API key. Every validated request counts against the visitor limit, whether or not the external id is linked. X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset describe the limit that refused the request, and Retry-After gives the seconds to wait.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/sso/identities":{"post":{"tags":["SSO"],"summary":"Create a server-to-server identity link","description":"Binds an external identity (idp_entity_id + external_id) to an existing Agend user, only on linking authority the platform holds for that user on the connection, and resolves or creates the CRM contact per the connection's jit_contact_provisioning setting. It never creates the platform user. An idp_entity_id matching no connection on the API key account auto-creates a WordPress connection when the calling key additionally holds sso.connections.create; otherwise the call fails with 403. A connection is created pending Agend approval, and the call fails with 403 CONNECTION_NOT_APPROVED, linking nothing, until Agend approves it and it is active. Re-posting an already-linked pair is idempotent (200, created: false). Where no linking authority holds for the resolved user, or the user already holds a password and is not yet verified, the link is withheld and 202 verification_required is returned instead — no identity link, user, or contact is created on that path. Where the email resolves to a user already linked under a different external_id on this connection, or the pair is linked to a different user, the call fails with 409. Requires the sso.identities.create scope.","security":[{"apiKey":["sso.identities.create"]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"idp_entity_id":{"type":"string","minLength":1,"maxLength":2048},"external_id":{"type":"string","minLength":1,"maxLength":255},"email":{"type":"string","format":"email"},"contact":{"type":"object","properties":{"first_name":{"type":"string","minLength":1,"maxLength":120},"last_name":{"type":"string","minLength":1,"maxLength":120}},"additionalProperties":false}},"required":["idp_entity_id","external_id","email"],"additionalProperties":false}}}},"responses":{"200":{"description":"Identity link already existed for this (idp_entity_id, external_id) pair (idempotent re-post)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoIdentityLinkConfirmed"}}}},"201":{"description":"Identity link created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoIdentityLinkCreated"}}}},"202":{"description":"The link is withheld: no linking authority holds for the resolved user on this connection, or the user holds a password and the matching contact is not verified. Nothing was created; a verification email is dispatched to the address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoIdentityLinkWithheld"}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key, or insufficient scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"CONNECTION_CREATE_FORBIDDEN: no SSO connection matches idp_entity_id, and the calling key does not hold sso.connections.create to auto-create one. CONNECTION_NOT_APPROVED: the connection for idp_entity_id is pending Agend approval or inactive, so nothing was linked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No CRM contact matches the supplied email, and the resolved connection does not allow contact provisioning; no existing user this account can reach holds the email, including when JIT provisioning is disabled; or the identity link is not enabled on this deployment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The resolved user already holds a different external_id on this connection, or the (idp_entity_id, external_id) pair is linked to a different user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/workflows/upbeat/record-refreshes":{"post":{"tags":["Workflows"],"summary":"Refresh one Upbeat record","description":"Names one record of an Upbeat custom collection by `resource_path` and the `lookup_value` that resource reads a single record by (for `members`, the membership number). The request is validated and queued for every live workflow trigger in the key's organisation that reads that resource path, and `data` is an array with one `{ workflow_id, outcome }` entry per matching workflow, each with outcome `requested`; it is an empty array, and nothing is queued, when no trigger matches. The refresh runs asynchronously: Agend then reads the record alone and, when it is in the trigger feed and has changed since its last delivery, starts the same workflow run the next polling check would start. The outcomes `run_requested`, `unchanged`, `not_in_feed`, `lookup_unconfirmed` and `lookup_failed` are recorded server side and are no longer returned by this operation. `requested` does not confirm that a run started, and a refresh that is lost is still covered by the next polling check. `data` holds no record values. A refresh never reports a withdrawal and does not move the polling cursor. Requires `workflows.records.refresh` scope.","security":[{"apiKey":["workflows.records.refresh"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpbeatRecordRefreshRequest"}}}},"responses":{"200":{"description":"One `requested` entry per matching workflow; an empty array when none match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpbeatRecordRefreshResponse"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Insufficient scopes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/embed/auth/exchange":{"post":{"tags":["Embed"],"summary":"Exchange an external identity for an embed bootstrap token","description":"Server-to-server call from a trusted host integration (e.g. a WordPress plugin holding a secret key). Resolves the external identity to an Agend user via the account SSO connection, re-checks membership, and mints a single-use bootstrap token (5 minute TTL) the host hands to the embed iframe. Requires `embed.session.create`.","security":[{"apiKey":["embed.session.create"]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-api-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbedExchangeRequest"}}}},"responses":{"200":{"description":"Bootstrap token minted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbedExchangeResponseEnvelope"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"API key not authorised for the account, or not a member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"SSO connection or user not found. An identity link recorded before linking authority was recorded, or demoted since, is not proven and is answered exactly as an identity never linked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{agentName}/chat":{"post":{"tags":["Agents"],"summary":"Stream a chat turn with a specialist agent","description":"Reverse-proxies the chat turn to the dashboard-hosted agent runtime and streams the AI-SDK Server-Sent Events response straight back, token by token. Legacy callers use the `agents.chat` API-key scope plus a Supabase user bearer; mobile callers use the ordinary bearer and an organisation-scoped mobile session. The acting user must hold the `agents.manage` permission. The `x-conversation-id` response header carries the persisted conversation id.","security":[{"apiKey":["agents.chat"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","description":"Slug of the specialist agent to converse with."},"required":true,"name":"agentName","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatRequest"}}}},"responses":{"200":{"description":"Server-Sent Events stream of the agent turn","content":{"text/event-stream":{"schema":{"type":"string","description":"AI-SDK data-stream SSE frames."}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/proposals/{proposalId}/approve":{"post":{"tags":["Agents"],"summary":"Approve an agent intervention proposal","description":"Reverse-proxies the approve decision for a pending agent intervention proposal to the dashboard runtime and returns its JSON response verbatim. Requires the `agents.interventions.manage` scope and a Supabase user bearer token, or an organisation-scoped mobile session; the acting user must hold the `agents.manage` permission.","security":[{"apiKey":["agents.interventions.manage"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","description":"Id of the pending intervention proposal."},"required":true,"name":"proposalId","in":"path"}],"responses":{"200":{"description":"Decision applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposalActionResult"}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/proposals/{proposalId}/reject":{"post":{"tags":["Agents"],"summary":"Reject an agent intervention proposal","description":"Reverse-proxies the reject decision for a pending agent intervention proposal to the dashboard runtime and returns its JSON response verbatim. Requires the `agents.interventions.manage` scope and a Supabase user bearer token, or an organisation-scoped mobile session; the acting user must hold the `agents.manage` permission.","security":[{"apiKey":["agents.interventions.manage"],"userBearer":[]},{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","description":"Id of the pending intervention proposal."},"required":true,"name":"proposalId","in":"path"}],"responses":{"200":{"description":"Decision applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposalActionResult"}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/tasks/assignees":{"get":{"tags":["Agents"],"summary":"List eligible assignees for an Ask Aggie task draft","description":"Returns current non-contact account staff eligible for a canonical CRM task. Requires a staff mobile session, the agents product entitlement, and the existing agents.manage and deals.manage role permissions.","security":[{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","maxLength":100},"required":false,"name":"search","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Eligible assignees","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid"},"display_name":{"type":"string"},"account_role":{"type":"string"}},"required":["user_id","display_name","account_role"]}}},"required":["success","data"]}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/tasks/confirmations":{"post":{"tags":["Agents"],"summary":"Confirm one reviewed Ask Aggie task draft","description":"Atomically validates the persisted conversation draft, creates one canonical CRM task, and stores a durable idempotency receipt. An identical retry returns the original outcome; changed content for the same logical draft returns 409.","security":[{"supabaseBearer":[],"mobileSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirmation_id":{"type":"string","format":"uuid"},"source_conversation_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string","minLength":1,"maxLength":128},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"draft_id":{"type":"string","minLength":1,"maxLength":128},"draft_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string","minLength":1,"maxLength":180},"description":{"type":["string","null"],"maxLength":1200},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["confirmation_id","source_conversation_id","source_user_turn_id","draft_bundle_message_id","bundle_id","bundle_revision","draft_id","draft_revision","title"]}}}},"responses":{"200":{"description":"Previously committed confirmation reconciled","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"result":{"type":"string","enum":["created","reconciled"]},"status":{"type":"string","enum":["created","deleted"]},"original_task_id":{"type":["string","null"],"format":"uuid"},"task_id":{"type":["string","null"],"format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"source_user_turn_id":{"type":["string","null"],"format":"uuid"},"draft_bundle_message_id":{"type":["string","null"],"format":"uuid"},"draft_revision":{"type":"integer","exclusiveMinimum":0},"task_url":{"type":["string","null"],"format":"uri"}},"required":["result","status","original_task_id","task_id","title","description","assignee_id","due_on","source_user_turn_id","draft_bundle_message_id","draft_revision","task_url"]}},"required":["success","data"]}}}},"201":{"description":"Task and confirmation receipt created atomically","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"result":{"type":"string","enum":["created","reconciled"]},"status":{"type":"string","enum":["created","deleted"]},"original_task_id":{"type":["string","null"],"format":"uuid"},"task_id":{"type":["string","null"],"format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"source_user_turn_id":{"type":["string","null"],"format":"uuid"},"draft_bundle_message_id":{"type":["string","null"],"format":"uuid"},"draft_revision":{"type":"integer","exclusiveMinimum":0},"task_url":{"type":["string","null"],"format":"uri"}},"required":["result","status","original_task_id","task_id","title","description","assignee_id","due_on","source_user_turn_id","draft_bundle_message_id","draft_revision","task_url"]}},"required":["success","data"]}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Logical draft already confirmed with different content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"get":{"tags":["Agents"],"summary":"Reconcile an Ask Aggie task confirmation outcome","description":"Returns the retained created or deleted terminal outcome for a logical draft. The receipt survives source and canonical task deletion and never recreates it.","security":[{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"conversation_id","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":128},"required":true,"name":"draft_id","in":"query"}],"responses":{"200":{"description":"Confirmation outcome","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"result":{"type":"string","enum":["created","reconciled"]},"status":{"type":"string","enum":["created","deleted"]},"original_task_id":{"type":["string","null"],"format":"uuid"},"task_id":{"type":["string","null"],"format":"uuid"},"title":{"type":"string"},"description":{"type":["string","null"]},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"source_user_turn_id":{"type":["string","null"],"format":"uuid"},"draft_bundle_message_id":{"type":["string","null"],"format":"uuid"},"draft_revision":{"type":"integer","exclusiveMinimum":0},"task_url":{"type":["string","null"],"format":"uri"}},"required":["result","status","original_task_id","task_id","title","description","assignee_id","due_on","source_user_turn_id","draft_bundle_message_id","draft_revision","task_url"]}},"required":["success","data"]}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No confirmation exists for the logical draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/conversations":{"get":{"tags":["Agents"],"summary":"List the acting staff users Ask Aggie conversations","security":[{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Owner-bound conversation history","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"agent_name":{"type":"string"},"title":{"type":["string","null"]},"updated_at":{"type":"string"}},"required":["id","agent_name","title","updated_at"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}},"required":["success","data"]}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/conversations/{conversationId}":{"get":{"tags":["Agents"],"summary":"Restore one owner-bound Ask Aggie conversation and task drafts","security":[{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"conversationId","in":"path"}],"responses":{"200":{"description":"Persisted UI messages and durable task review state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"agent_name":{"type":"string"},"title":{"type":["string","null"]},"updated_at":{"type":"string"},"source_url":{"type":"string","format":"uri"},"messages":{"type":"array","items":{"type":"object","additionalProperties":{}}},"draft_states":{"type":"array","items":{"type":"object","properties":{"draft_id":{"type":"string"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string"},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string"},"description":{"type":["string","null"]},"assignee":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"display_name":{"type":"string"}},"required":["id","display_name"]},"due_on":{"type":["string","null"]},"selected":{"type":"boolean"},"state_version":{"type":["integer","null"],"exclusiveMinimum":0},"review_revision":{"type":"integer","exclusiveMinimum":0},"confirmation":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"review_revision":{"type":"integer","exclusiveMinimum":0},"status":{"type":"string","enum":["pending","created","deleted"]},"task_id":{"type":["string","null"],"format":"uuid"},"original_task_id":{"type":["string","null"],"format":"uuid"},"task_url":{"type":["string","null"],"format":"uri"},"request":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"source_conversation_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string","minLength":1,"maxLength":128},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"draft_id":{"type":"string","minLength":1,"maxLength":128},"draft_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string","minLength":1,"maxLength":180},"description":{"type":["string","null"],"maxLength":1200},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["confirmation_id","source_conversation_id","source_user_turn_id","draft_bundle_message_id","bundle_id","bundle_revision","draft_id","draft_revision","title"]}},"required":["confirmation_id","review_revision","status","task_id","original_task_id","task_url","request"]}},"required":["draft_id","draft_bundle_message_id","source_user_turn_id","bundle_id","bundle_revision","title","description","assignee","due_on","selected","state_version","review_revision","confirmation"]}}},"required":["id","agent_name","title","updated_at","source_url","messages","draft_states"]}},"required":["success","data"]}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Conversation is absent or not owned by the actor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/conversations/{conversationId}/task-drafts/{draftId}":{"patch":{"tags":["Agents"],"summary":"Persist edited task draft state with compare-and-swap","security":[{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"conversationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"draftId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"draft_bundle_message_id":{"type":"string","format":"uuid"},"expected_state_version":{"type":["integer","null"],"exclusiveMinimum":0},"title":{"type":"string","minLength":1,"maxLength":180},"description":{"type":["string","null"],"maxLength":1200},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"]},"selected":{"type":"boolean"}},"required":["draft_bundle_message_id","expected_state_version","title","description","assignee_id","due_on","selected"]}}}},"responses":{"200":{"description":"Durably saved draft state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"draft_id":{"type":"string"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string"},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string"},"description":{"type":["string","null"]},"assignee":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"display_name":{"type":"string"}},"required":["id","display_name"]},"due_on":{"type":["string","null"]},"selected":{"type":"boolean"},"state_version":{"type":["integer","null"],"exclusiveMinimum":0},"review_revision":{"type":"integer","exclusiveMinimum":0},"confirmation":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"review_revision":{"type":"integer","exclusiveMinimum":0},"status":{"type":"string","enum":["pending","created","deleted"]},"task_id":{"type":["string","null"],"format":"uuid"},"original_task_id":{"type":["string","null"],"format":"uuid"},"task_url":{"type":["string","null"],"format":"uri"},"request":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"source_conversation_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string","minLength":1,"maxLength":128},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"draft_id":{"type":"string","minLength":1,"maxLength":128},"draft_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string","minLength":1,"maxLength":180},"description":{"type":["string","null"],"maxLength":1200},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["confirmation_id","source_conversation_id","source_user_turn_id","draft_bundle_message_id","bundle_id","bundle_revision","draft_id","draft_revision","title"]}},"required":["confirmation_id","review_revision","status","task_id","original_task_id","task_url","request"]}},"required":["draft_id","draft_bundle_message_id","source_user_turn_id","bundle_id","bundle_revision","title","description","assignee","due_on","selected","state_version","review_revision","confirmation"]}},"required":["success","data"]}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Stale state or frozen pending review","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/conversations/{conversationId}/task-drafts/{draftId}/review":{"post":{"tags":["Agents"],"summary":"Freeze a saved task draft for explicit confirmation","security":[{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"conversationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"draftId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"draft_bundle_message_id":{"type":"string","format":"uuid"},"expected_state_version":{"type":"integer","exclusiveMinimum":0}},"required":["draft_bundle_message_id","expected_state_version"]}}}},"responses":{"200":{"description":"Frozen review snapshot","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"draft_id":{"type":"string"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string"},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string"},"description":{"type":["string","null"]},"assignee":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"display_name":{"type":"string"}},"required":["id","display_name"]},"due_on":{"type":["string","null"]},"selected":{"type":"boolean"},"state_version":{"type":["integer","null"],"exclusiveMinimum":0},"review_revision":{"type":"integer","exclusiveMinimum":0},"confirmation":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"review_revision":{"type":"integer","exclusiveMinimum":0},"status":{"type":"string","enum":["pending","created","deleted"]},"task_id":{"type":["string","null"],"format":"uuid"},"original_task_id":{"type":["string","null"],"format":"uuid"},"task_url":{"type":["string","null"],"format":"uri"},"request":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"source_conversation_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string","minLength":1,"maxLength":128},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"draft_id":{"type":"string","minLength":1,"maxLength":128},"draft_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string","minLength":1,"maxLength":180},"description":{"type":["string","null"],"maxLength":1200},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["confirmation_id","source_conversation_id","source_user_turn_id","draft_bundle_message_id","bundle_id","bundle_revision","draft_id","draft_revision","title"]}},"required":["confirmation_id","review_revision","status","task_id","original_task_id","task_url","request"]}},"required":["draft_id","draft_bundle_message_id","source_user_turn_id","bundle_id","bundle_revision","title","description","assignee","due_on","selected","state_version","review_revision","confirmation"]}},"required":["success","data"]}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Stale or incompatible draft review state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Agents"],"summary":"Explicitly release an unresolved pending review","security":[{"supabaseBearer":[],"mobileSession":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"conversationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"draftId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"draft_bundle_message_id":{"type":"string","format":"uuid"},"expected_state_version":{"type":"integer","exclusiveMinimum":0},"pending_confirmation_id":{"type":"string","format":"uuid"}},"required":["draft_bundle_message_id","expected_state_version","pending_confirmation_id"]}}}},"responses":{"200":{"description":"Released state or receipt-wins outcome","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"result":{"type":"string","enum":["released","receipt"]},"draft_state":{"type":"object","properties":{"draft_id":{"type":"string"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string"},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string"},"description":{"type":["string","null"]},"assignee":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"display_name":{"type":"string"}},"required":["id","display_name"]},"due_on":{"type":["string","null"]},"selected":{"type":"boolean"},"state_version":{"type":["integer","null"],"exclusiveMinimum":0},"review_revision":{"type":"integer","exclusiveMinimum":0},"confirmation":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"review_revision":{"type":"integer","exclusiveMinimum":0},"status":{"type":"string","enum":["pending","created","deleted"]},"task_id":{"type":["string","null"],"format":"uuid"},"original_task_id":{"type":["string","null"],"format":"uuid"},"task_url":{"type":["string","null"],"format":"uri"},"request":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"source_conversation_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string","minLength":1,"maxLength":128},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"draft_id":{"type":"string","minLength":1,"maxLength":128},"draft_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string","minLength":1,"maxLength":180},"description":{"type":["string","null"],"maxLength":1200},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["confirmation_id","source_conversation_id","source_user_turn_id","draft_bundle_message_id","bundle_id","bundle_revision","draft_id","draft_revision","title"]}},"required":["confirmation_id","review_revision","status","task_id","original_task_id","task_url","request"]}},"required":["draft_id","draft_bundle_message_id","source_user_turn_id","bundle_id","bundle_revision","title","description","assignee","due_on","selected","state_version","review_revision","confirmation"]},"confirmation":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"review_revision":{"type":"integer","exclusiveMinimum":0},"status":{"type":"string","enum":["pending","created","deleted"]},"task_id":{"type":["string","null"],"format":"uuid"},"original_task_id":{"type":["string","null"],"format":"uuid"},"task_url":{"type":["string","null"],"format":"uri"},"request":{"type":["object","null"],"properties":{"confirmation_id":{"type":"string","format":"uuid"},"source_conversation_id":{"type":"string","format":"uuid"},"source_user_turn_id":{"type":"string","format":"uuid"},"draft_bundle_message_id":{"type":"string","format":"uuid"},"bundle_id":{"type":"string","minLength":1,"maxLength":128},"bundle_revision":{"type":"integer","exclusiveMinimum":0},"draft_id":{"type":"string","minLength":1,"maxLength":128},"draft_revision":{"type":"integer","exclusiveMinimum":0},"title":{"type":"string","minLength":1,"maxLength":180},"description":{"type":["string","null"],"maxLength":1200},"assignee_id":{"type":["string","null"],"format":"uuid"},"due_on":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["confirmation_id","source_conversation_id","source_user_turn_id","draft_bundle_message_id","bundle_id","bundle_revision","draft_id","draft_revision","title"]}},"required":["confirmation_id","review_revision","status","task_id","original_task_id","task_url","request"]}},"required":["result","draft_state","confirmation"]}},"required":["success","data"]}}}},"400":{"description":"Malformed request (missing agent/proposal id or body)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid API key or user bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Key lacks the required scope, or the bearer user may not act on this agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Stale or incompatible draft review state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to reach the agent service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/mobile/me/organisations":{"get":{"tags":["Mobile Access"],"summary":"Discover mobile-enabled organisations","description":"Returns Mobile-enabled organisations visible to the verified Supabase user and allowed by the current session scope. Member logo_url and brand_color use the canonical published portal appearance when available, with published site settings as the compatibility fallback. Email fallback is derived only from the freshly loaded, confirmed Auth identity. Without x-agend-mobile-contract the response is member-only. Header value 2 selects the profile-aware response.","security":[{"supabaseBearer":[]}],"parameters":[{"schema":{"type":"string","enum":["2"],"description":"Optional opt-in to the profile-aware response. Omit for the unchanged member-only response; send 2 for the member/staff profile contract."},"required":false,"name":"x-agend-mobile-contract","in":"header"}],"responses":{"200":{"description":"Visible mobile organisations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileOrganisationsResponse"}}}},"401":{"description":"Missing or invalid Supabase bearer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Discovery rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Organisation discovery failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/mobile/me/session":{"post":{"tags":["Mobile Access"],"summary":"Create an organisation-scoped mobile session","description":"Omitting x-agend-mobile-contract and profile preserves the existing member session contract. Send x-agend-mobile-contract: 2 to receive explicit profiles and select member or staff authority with the profile body field.","security":[{"supabaseBearer":[]}],"parameters":[{"schema":{"type":"string","enum":["2"],"description":"Optional opt-in to the profile-aware response. Omit for the unchanged member-only response; send 2 for the member/staff profile contract."},"required":false,"name":"x-agend-mobile-contract","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"profile":{"type":"string","enum":["member","staff"],"default":"member"}},"required":["account_id"],"additionalProperties":false}}}},"responses":{"200":{"description":"Mobile session created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileSessionResponse"}}}},"400":{"description":"Invalid account selection body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing or invalid Supabase bearer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The calling session may not act on this organisation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Selected organisation is not visible or mobile-enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Selected membership requires renewal or is blocked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Session creation rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Session scope check, persistence, or signing failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Mobile Access"],"summary":"Revoke the current mobile session","description":"Revokes the verified current member or staff session using the server-assigned mobile.sessions.revoke scope. No CRM membership scope is required.","security":[{"supabaseBearer":[],"mobileSession":[]}],"responses":{"200":{"description":"Mobile session revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileSessionRevocationResponse"}}}},"401":{"description":"Missing, invalid, or mismatched bearer credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Session revocation rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Session revocation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"webhooks":{"crm.order.paid":{"post":{"tags":["Webhooks: CRM Orders"],"summary":"A CRM order was paid","description":"Fires when a `crm_orders` row transitions to payment_status=paid. Emitted by the cart fulfilment service after the order and its `crm_order_items` have been written and the cart has been deleted. Subscribers can rely on the row being durably present at fan-out time.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.order.paid"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmOrderPaidEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.order.failed":{"post":{"tags":["Webhooks: CRM Orders"],"summary":"A CRM order failed to be paid","description":"Fires when a checkout attempt against an order fails irrecoverably. Provider details are scrubbed from the `reason` field.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.order.failed"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmOrderFailedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.order.refunded":{"post":{"tags":["Webhooks: CRM Orders"],"summary":"A CRM order was refunded","description":"Fires when a refund is recorded against a paid order. `partial` distinguishes a partial refund (`refund_cents < total_cents`) from a full one. Emitted once per order whether the refund originates from the staff refund action or a lost-dispute reversal.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.order.refunded"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmOrderRefundedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.membership.created":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A membership was created","description":"Fires when a membership is created outside the payment rail: staff assignment in the CRM dashboard or `POST /v1/crm/memberships`, including a corporate membership staff add to a company (`company_id` is set). Purchase-driven memberships fire `crm.order.paid` and the renewal lifecycle events instead.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.membership.created"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmMembershipCreatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.membership.updated":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A membership was manually changed","description":"Fires on a manual (staff-driven) membership change: an inline tier change (`previous_tier_id` set) or a staff-recorded renewal/reactivation (`previous_status` set). `status` and `previous_status` can be grace. It also fires, with `previous_status` grace and `status` active, when a membership in grace returns to active because its tier was set to keep access or staff set its charging status to no charge or cancelled. Payment-driven transitions fire `crm.membership.renewed` / `crm.membership.reinstated` instead, and so does a staff renewal of a membership in grace (`crm.membership.reinstated` with `order_id` null).","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.membership.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmMembershipUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.membership.cancelled":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A membership was cancelled","description":"Fires when a membership is cancelled by staff in the CRM dashboard or via `POST /v1/crm/memberships/{id}` cancel / `DELETE /v1/crm/memberships/{id}`, and when a full refund, a lost dispute or a sold-out refund reverses the order that bought it (`reason` is `refund`). `previous_status` carries the status it held before cancellation. For a corporate membership, `crm.membership.seats_affected` accompanies it, in no guaranteed order, and lists the seat holders whose standing changed.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.membership.cancelled"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmMembershipCancelledEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.membership.renewed":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A membership was renewed","description":"Fires when a renewal order is fulfilled for an already-active membership and the membership dates advance. Emitted by every renewal fulfilment route (auto-charge, offline settlement, member-portal Pay Now, and the gateway webhook), exactly once per pending→paid transition.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.membership.renewed"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmMembershipRenewedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.membership.reinstated":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A lapsed membership was reinstated","description":"Fires when a renewal payment returns a membership in grace, or a lapsed, expired or cancelled membership, to active, and when staff renew a membership in grace (`order_id` is then null). `previous_status` carries the status it held before reinstatement.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.membership.reinstated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmMembershipReinstatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.membership.lapsed":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A membership lapsed","description":"Fires once when a membership lapses after its grace period elapses without a renewal payment, whether the renewal sweep or the daily lifecycle scan makes the change. `previous_status` is the status the membership held immediately before it lapsed, for example `active` or `grace`; it is absent when it was not recorded. For a corporate membership, `crm.membership.seats_affected` accompanies it, in no guaranteed order, and lists the seat holders whose standing changed.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.membership.lapsed"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmMembershipLapsedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.membership.grace_started":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A membership entered grace","description":"Fires once when an unpaid membership on a tier that removes access during grace moves from active to grace at its paid-to date. `previous_status` is active and `grace_ends_on` is the last day of grace. Paying returns the membership to active and fires `crm.membership.reinstated` with `previous_status` grace; if it is not paid it lapses and fires `crm.membership.lapsed` with `previous_status` grace. A membership on a tier that keeps access during grace stays active through grace and never fires this event. For a corporate membership, `crm.membership.seats_affected` accompanies it, in no guaranteed order.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.membership.grace_started"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmMembershipGraceStartedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.membership.seats_affected":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A corporate membership's change affects its seat holders","description":"Fires when a corporate membership starts or stops granting standing: it entered grace, lapsed, expired or was cancelled (`holds_standing` is false), or it was reinstated (`holds_standing` is true). It lists the contact ids of the active seat holders, because no seat changes and no `crm.seat.*` event follows. One change emits one or more events, ordered by `batch_index`, each carrying at most 1,000 `seat_contact_ids`; `batch_count` and `seat_count` say how many events and how many ids to expect, and across all the events every active seat holder appears exactly once. Disabled and invited seats are not listed. Nothing fires for an individual membership, for a company with no active seat holders, or for a change that does not move standing. Use the ids to locate the members, then re-read their standing with the member bearer rather than trusting the payload as data. Deliveries are at least once and not ordered, so order a change's batches by `batch_index`.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.membership.seats_affected"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmMembershipSeatsAffectedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.seat.added":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A corporate seat was added","description":"Fires when a corporate seat is created: staff assignment in the CRM dashboard, a gateway seat route, an accepted team invitation, or corporate-seat checkout fulfilment. `contact_id` is the seat holder.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.seat.added"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSeatAddedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.seat.updated":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A corporate seat was changed","description":"Fires when a seat's role or status changes (e.g. disabled or reactivated). `previous_status` / `previous_role` carry the values before the change; unchanged dimensions are null. A seat holder has membership standing only while the seat is `active` and its corporate membership (`corporate_membership_id`) is current, and only when the organisation lets corporate seats confer membership. A seat's own status does not change when its corporate membership lapses or is cancelled, so this event does not follow that: `crm.membership.seats_affected` lists the seat holders instead.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.seat.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSeatUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.seat.removed":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A corporate seat was removed","description":"Fires when a corporate seat is deleted (staff removal in the dashboard, a gateway seat route, or the corporate holder removing a team member). The payload carries the seat's final state; `contact_id` is the holder whose standing ends.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.seat.removed"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSeatRemovedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.subscription.suspended":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A dependent subscription was suspended","description":"Fires when a subscription (e.g. insurance) is suspended because its governing membership went inactive. Register-only: emission is pending a dedicated emit path for the trigger-driven cascade.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.subscription.suspended"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSubscriptionSuspendedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.subscription.reactivated":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A dependent subscription was reactivated","description":"Fires when a subscription suspended for membership inactivity returns to active because its governing membership was reinstated. Register-only: emission is pending a dedicated emit path for the trigger-driven cascade.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.subscription.reactivated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSubscriptionReactivatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.order.disputed":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A CRM order was disputed","description":"Fires when a payment dispute (chargeback) is opened against an order. Register-only: emitted by the US-2.5 dispute-open path, which is not yet built.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.order.disputed"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmOrderDisputedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.order.dispute_resolved":{"post":{"tags":["Webhooks: CRM Billing"],"summary":"A CRM order dispute was resolved","description":"Fires when a dispute is closed. `outcome` is `won` or `lost`; a lost dispute additionally reverses the order and emits `crm.order.refunded`. Register-only: emitted by the US-2.5 dispute-close path, which is not yet built.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.order.dispute_resolved"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmOrderDisputeResolvedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.entitlement.granted":{"post":{"tags":["Webhooks: CRM Entitlements"],"summary":"A member gained entitlements","description":"Fires when a direct entitlement grant is made or changes what a member holds: a new grant, a grant reinstated after a revoke, or a refresh that moves its `starts_at` or `expires_at`. Emitted by `POST /v1/crm/entitlements/grants`, a staff grant in the CRM dashboard, and digital product checkout. One event per contact per write, carrying every key that changed in `gate_keys`; never one per key. A repeat call that changed nothing, and a refresh that changed only quantities, fire nothing. Tier-derived capabilities fire the `crm.membership.*` and `crm.seat.*` events instead. Use `contact_id` to locate the member, then re-read `GET /v1/crm/me/entitlements` with the member bearer rather than trusting the payload as data.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.entitlement.granted"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmEntitlementGrantedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.entitlement.revoked":{"post":{"tags":["Webhooks: CRM Entitlements"],"summary":"A member lost entitlements","description":"Fires when direct entitlement grants are revoked: a key absent from a `POST /v1/crm/entitlements/grants` reconcile for its source, or a staff revoke in the CRM dashboard. One event per contact per write, carrying every revoked key in `gate_keys`. A grant that simply reaches its `expires_at` fires nothing, because no write happens: read `expires_at` on `GET /v1/crm/me/entitlements` to know when. Use `contact_id` to locate the member, then re-read their entitlements.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.entitlement.revoked"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmEntitlementRevokedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.benefit.changed":{"post":{"tags":["Webhooks: CRM Entitlements"],"summary":"The entitlement catalogue changed what members hold","description":"Account-wide. Fires when a membership tier gains or loses a benefit, or when a benefit that carries a `gate_key` is activated, deactivated or given a different key, because each changes which members hold which capabilities without touching any grant. `change` is `tier_benefit_added`, `tier_benefit_removed`, `benefit_activated`, `benefit_deactivated` or `benefit_gate_key_changed`; one write that both re-keys and flips `is_active` reports `benefit_gate_key_changed` once. `tier_id` is set for a tier assignment and null for a change to the benefit itself. A display-only benefit (no `gate_key`), a rename, a new benefit and the deletion of an unused one fire nothing. Clear every member's cached entitlements, then re-read `GET /v1/crm/me/entitlements` with the member bearer; the payload does not list the members affected.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.benefit.changed"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmBenefitChangedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.contact.attributes_changed":{"post":{"tags":["Webhooks: CRM Contacts"],"summary":"A contact's segment-relevant fields changed","description":"Fires when a write really changes a contact's status, tags, custom field values or topic follows, which are the contact facts a segment rule reads. Emitted by `PATCH /v1/crm/contacts/{id}`, the bulk update operation, `PATCH /v1/crm/me`, the CRM dashboard's contact editor and tag actions, and a member following or unfollowing a topic. One event per contact per write. `changed_fields` names the segment rule field ids that changed (`sys-status`, `sys-tags`, `sys-follows-topic`, or `custom-<field_key>`), never their values. A write that changes none of them, such as a name or phone edit or a save of identical values, fires nothing. Engagement score, last activity and last login change on every request and never fire it, and a relative-date rule or a grace period changes on a clock, so bound those with your cache lifetime. Membership changes fire `crm.membership.*` and `crm.seat.*`, and entitlement grants fire `crm.entitlement.*`. Use `contact_id` to locate the member, then re-read `GET /v1/crm/me/segments` and `GET /v1/crm/me/entitlements` with the member bearer rather than trusting the payload as data. This is not `crm.contact.updated`, which reports an upstream source record being ingested.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.contact.attributes_changed"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmContactAttributesChangedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.contact.bulk_updated":{"post":{"tags":["Webhooks: CRM Contacts"],"summary":"A bulk write changed many contacts","description":"Account-wide. Fires once, instead of one `crm.contact.attributes_changed` per contact, when a single bulk action changed more than 100 contacts (the bulk tag action reaches up to 5,000). An action that changed exactly 100 or fewer contacts fires per contact instead. `contact_count` is how many contacts changed and `changed_fields` the union of segment rule field ids that changed. The contacts are not listed: clear every member's cached segments and entitlements, then re-read them with the member bearer.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.contact.bulk_updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmContactBulkUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"crm.segment.updated":{"post":{"tags":["Webhooks: CRM Segments"],"summary":"A segment was created, redefined or deleted","description":"Account-wide. Segments are computed at query time from their filter criteria, so creating one, editing its criteria or deleting it changes which members belong to it without touching any contact. `change` is `created`, `criteria_changed` or `deleted`. A rename, a description or sharing change, a usage counter and a save of identical criteria fire nothing. The payload never carries the criteria. Clear every member's cached segments, then re-read `GET /v1/crm/me/segments` with the member bearer.","security":[],"parameters":[{"schema":{"type":"string","enum":["crm.segment.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSegmentUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"events.event.published":{"post":{"tags":["Webhooks: Events"],"summary":"An event was published","description":"Fires when an event transitions to status=published. `scheduled` is true when the published_at is in the future.","security":[],"parameters":[{"schema":{"type":"string","enum":["events.event.published"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsEventPublishedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"events.event.updated":{"post":{"tags":["Webhooks: Events"],"summary":"An event was updated","description":"Fires after any mutation to an event row, including category/tag/custom-field changes. `changed_fields` lists the touched columns.","security":[],"parameters":[{"schema":{"type":"string","enum":["events.event.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsEventUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"events.event.cancelled":{"post":{"tags":["Webhooks: Events"],"summary":"An event was cancelled","description":"Fires when an event transitions to status=cancelled. Existing registrations are preserved; consumers typically notify attendees.","security":[],"parameters":[{"schema":{"type":"string","enum":["events.event.cancelled"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsEventCancelledEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"events.event.deleted":{"post":{"tags":["Webhooks: Events"],"summary":"An event was soft-deleted","description":"Fires when an event is soft-deleted (deleted_at set). The row is preserved for audit; consumers typically remove the event from caches.","security":[],"parameters":[{"schema":{"type":"string","enum":["events.event.deleted"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsEventDeletedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"jobs.submission.approved":{"post":{"tags":["Webhooks: Jobs"],"summary":"A member job submission was approved","description":"Fires when staff approve a pending member job submission. The job is live on the board from now for the organisation board default period. Use `credit_ref` to confirm the credit that paid for it: the CRM job credit Agend spent for a `/v1/jobs/submissions` post, or the opaque value a connected site sent for a submission made before the website submission routes. `contact_external_source` and `contact_external_id` together name the submitting contact. Written in the same database transaction as the approval, so a committed approval always has its event. Delivery is at least once: dedupe on the envelope `id`.","security":[],"parameters":[{"schema":{"type":"string","enum":["jobs.submission.approved"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobsSubmissionApprovedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"jobs.submission.rejected":{"post":{"tags":["Webhooks: Jobs"],"summary":"A member job submission was rejected","description":"Fires when staff reject a pending member job submission. The state is terminal and the credit reference is released for reuse. A `/v1/jobs/submissions` post has its CRM job credit released and written back to Upbeat by Agend, so the site does nothing. `contact_external_source` and `contact_external_id` together name the submitting contact. The rejection reason is shown to staff only and is not part of the payload. Written in the same database transaction as the rejection. Delivery is at least once: dedupe on the envelope `id`.","security":[],"parameters":[{"schema":{"type":"string","enum":["jobs.submission.rejected"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobsSubmissionRejectedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"jobs.submission.withdrawn":{"post":{"tags":["Webhooks: Jobs"],"summary":"A member job submission was withdrawn","description":"Fires when the submitting member withdraws a pending submission through `POST /v1/jobs/submissions/{id}/withdraw`. The state is terminal and the credit reference is released for reuse. A `/v1/jobs/submissions` post has its CRM job credit released and written back to Upbeat by Agend. `contact_external_source` and `contact_external_id` together name the submitting contact. Written in the same database transaction as the withdrawal. Delivery is at least once: dedupe on the envelope `id`.","security":[],"parameters":[{"schema":{"type":"string","enum":["jobs.submission.withdrawn"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobsSubmissionWithdrawnEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.created":{"post":{"tags":["Webhooks: LMS"],"summary":"A user enrolled in a course","description":"Fires when a new row lands in `enrollments` with a non-null `account_id`. Personal enrollments (no account) do not emit — there is no account-scoped subscriber for them.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.created"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentCreatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.completed":{"post":{"tags":["Webhooks: LMS"],"summary":"A user completed a course","description":"Fires exactly once when the enrollment flips to `completed=true`, whether the flip came from finishing the last lesson or from passing the course quiz. Emitted from the server-side completion path. Account-scoped — only enrollments owned by an account emit.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.completed"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentCompletedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.cancelled":{"post":{"tags":["Webhooks: LMS"],"summary":"A user was unenrolled from a course","description":"Fires when a user's course access is revoked. The contract is 'access revoked', NOT 'row deleted': subscribers must not infer deletion from this event. Two paths emit it. An interactive unenrolment deletes the row, so the identifying fields are read just before the delete and the row is gone by the time subscribers receive the event. A programmatic revocation (refund, cancelled purchase, withdrawn entitlement) retains the row with its access mode set to 'unenrolled', so the enrolment remains readable afterwards. Account-scoped.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.cancelled"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentCancelledEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.reset":{"post":{"tags":["Webhooks: LMS"],"summary":"A user's course progress was reset","description":"Fires when an admin resets an enrollment: lesson progress is cleared and the enrollment returns to 0% incomplete. Account-scoped.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.reset"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentResetEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.milestone":{"post":{"tags":["Webhooks: LMS"],"summary":"An enrollment crossed a progress milestone","description":"Fires when lesson completion pushes progress across a course-configured threshold (course `progress_milestones`, default 25/50/75). Each threshold fires once per enrollment; a completion that jumps past several thresholds emits one event per threshold. Threshold edits apply to each learner on their next lesson completion. A progress reset re-arms all milestones. 100% is announced via `lms.enrollment.completed`, never as a milestone.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.milestone"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentMilestoneEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.expired":{"post":{"tags":["Webhooks: LMS"],"summary":"An enrollment's access expired","description":"Fires when the expiry processor revokes access: either the course access window lapsed (`expiry_reason: 'time_limit'`) or the backing seat licence lapsed or was deactivated (`expiry_reason: 'seat_license'`). `access_mode` carries the post-expiry state ('expired' for lockout, 'read_only' otherwise). Emitted from the scheduled expiry job, so delivery lags the actual expiry instant by up to one cron interval.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.expired"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentExpiredEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.access_extended":{"post":{"tags":["Webhooks: LMS"],"summary":"An enrollment's access was extended","description":"Fires when an admin extends enrollment access by `extended_by_days`. `access_expires_at` is the new expiry instant; access returns to full mode.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.access_extended"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentAccessExtendedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.access_restored":{"post":{"tags":["Webhooks: LMS"],"summary":"An expired enrollment's access was restored","description":"Fires when an admin restores access to an expired enrollment. `access_expires_at` is the new expiry instant, or null when access was restored without a time limit.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.access_restored"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentAccessRestoredEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.updated":{"post":{"tags":["Webhooks: LMS"],"summary":"An enrolment's access expiry changed","description":"Fires once for every committed change to an enrolment's `access_expires_at`, whether written by a staff extension or restore, first access on a first-access countdown, course access recalculation, or the expiry computed when the enrolment was created. `previous_access_expires_at` is the value before the change, and a null `access_expires_at` means no known expiry instant, not permanently unlimited. The event account is the organisation that owns the course; the event is captured in the same transaction as the change and is not suppressed by `X-Agend-Suppress-Webhooks`. Order events for one enrolment by `sequence`, and do not require `lms.enrollment.created` first.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.enrollment.owner_lifecycle":{"post":{"tags":["Webhooks: LMS"],"summary":"A course-owned enrollment changed lifecycle state","description":"Fires transactionally when an enrollment is created, completed becomes true (including after a reset), or access is revoked. The event account is the course owner, even when the enrollment belongs to a different purchasing account or has no enrollment account. The payload identifies the enrollment and transition; consumers must read current state for a summary. Existing enrollment created, completed and cancelled webhooks retain their destinations and payloads.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.enrollment.owner_lifecycle"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsEnrollmentOwnerLifecycleEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.course.created":{"post":{"tags":["Webhooks: LMS"],"summary":"A course was created","description":"Fires when an admin creates a new course row with a non-null `owner_account_id`. Use to mirror the catalogue into search indexes, member portals, or LRS systems.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.course.created"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCourseCreatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.course.updated":{"post":{"tags":["Webhooks: LMS"],"summary":"A course was updated","description":"Fires after any mutation to a course row. `changed_fields` lists the column names that were touched so subscribers can selectively refresh.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.course.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCourseUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.course.deleted":{"post":{"tags":["Webhooks: LMS"],"summary":"A course was deleted","description":"Fires after a hard-delete of a course row. The payload carries the identifying fields read just before the delete; the row no longer exists by the time subscribers receive the event.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.course.deleted"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCourseDeletedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.course.concluded":{"post":{"tags":["Webhooks: LMS"],"summary":"A course was concluded","description":"Fires when the lifecycle service transitions a published course to 'concluded'. The course remains visible to enrolled learners but accepts no new enrolments.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.course.concluded"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCourseConcludedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.course.archived":{"post":{"tags":["Webhooks: LMS"],"summary":"A course was archived","description":"Fires when a course is archived. `from_status` records whether it was archived from 'draft', 'published', or 'concluded'. Archived courses become eligible for purge after 30 days.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.course.archived"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCourseArchivedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.course.purged":{"post":{"tags":["Webhooks: LMS"],"summary":"An archived course was permanently purged","description":"Fires after a hard-delete cascade of an archived course past its 30-day window. `records_deleted` and `audit_id` come from the purge transaction RPC; the course and its lessons, quizzes, and enrolments no longer exist.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.course.purged"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCoursePurgedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.course.duplicated":{"post":{"tags":["Webhooks: LMS"],"summary":"A new course was created from an archived template","description":"Fires when an archived course is copied into a fresh draft (lessons, quizzes, and questions included). `course_id`, `slug`, and `title` identify the new draft; `source_course_id` is the template.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.course.duplicated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCourseDuplicatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.course.published":{"post":{"tags":["Webhooks: LMS"],"summary":"A course was published","description":"Fires when a course's `published` flag flips to true. A generic `lms.course.updated` event (with `changed_fields: ['published']`) fires alongside for backwards compatibility — subscribe to this event to avoid diffing changed_fields.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.course.published"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCoursePublishedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.course.unpublished":{"post":{"tags":["Webhooks: LMS"],"summary":"A course was unpublished","description":"Fires when a course's `published` flag flips to false (returned to draft). A generic `lms.course.updated` event fires alongside for backwards compatibility.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.course.unpublished"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCourseUnpublishedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.lesson.created":{"post":{"tags":["Webhooks: LMS"],"summary":"A lesson was added to a course","description":"Fires when a new lesson is appended to a course. `account_id` comes from the parent course's `owner_account_id`.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.lesson.created"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsLessonCreatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.lesson.updated":{"post":{"tags":["Webhooks: LMS"],"summary":"A lesson was updated","description":"Fires after any mutation to a lesson row. `changed_fields` lists the columns that were touched. Reorder operations do NOT emit this event — they go through the batch RPC.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.lesson.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsLessonUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.lesson.deleted":{"post":{"tags":["Webhooks: LMS"],"summary":"A lesson was removed from a course","description":"Fires after a hard-delete of a lesson row. Progress rows for the lesson are cascade-deleted; subscribers typically remove the lesson from caches.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.lesson.deleted"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsLessonDeletedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.quiz.created":{"post":{"tags":["Webhooks: LMS"],"summary":"A quiz was added to a course","description":"Fires when a quiz is created. account_id comes from the parent course's owner_account_id.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.quiz.created"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsQuizCreatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.quiz.updated":{"post":{"tags":["Webhooks: LMS"],"summary":"A quiz or one of its questions was changed","description":"Fires after a quiz row mutation OR a question add/update/delete (changed_fields includes \"questions\" in the latter case). Subscribers mirroring assessments typically re-fetch the quiz with its questions on this event.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.quiz.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsQuizUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.quiz.deleted":{"post":{"tags":["Webhooks: LMS"],"summary":"A quiz was removed from a course","description":"Fires after a hard-delete of a quiz row. Questions are cascade-deleted.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.quiz.deleted"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsQuizDeletedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.badge.awarded":{"post":{"tags":["Webhooks: LMS"],"summary":"A badge was awarded to a user","description":"Fires when a course badge is awarded. account_id is the badge course's owning account.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.badge.awarded"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsBadgeAwardedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.badge.revoked":{"post":{"tags":["Webhooks: LMS"],"summary":"A badge was revoked from a user","description":"Fires after a badge is deleted. The identifying fields are read just before the delete.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.badge.revoked"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsBadgeRevokedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.certificate.issued":{"post":{"tags":["Webhooks: LMS"],"summary":"A certificate was issued","description":"Fires when a certificate row is created (CertificateService.createCertificate). account_id is the course's owning account. PDF generation is a separate downstream step.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.certificate.issued"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCertificateIssuedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.certificate.revoked":{"post":{"tags":["Webhooks: LMS"],"summary":"A certificate was revoked","description":"Fires after a certificate row is deleted. The identifying fields are read just before the delete.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.certificate.revoked"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsCertificateRevokedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.session.created":{"post":{"tags":["Webhooks: LMS"],"summary":"A scheduled session was added to a course","description":"Fires when a course session is created. account_id is the course's owning account.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.session.created"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsSessionCreatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.session.updated":{"post":{"tags":["Webhooks: LMS"],"summary":"A session was updated (including status changes)","description":"Fires after a session row mutation. `status` reflects the new value (scheduled / in_progress / completed / cancelled); `changed_fields` lists the columns touched.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.session.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsSessionUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.session.deleted":{"post":{"tags":["Webhooks: LMS"],"summary":"A session was removed from a course","description":"Fires after a hard-delete of a session row. The identifying fields are read just before the delete.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.session.deleted"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsSessionDeletedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.session.registration.created":{"post":{"tags":["Webhooks: LMS"],"summary":"A user registered for a session","description":"Fires when a learner registers for a scheduled session. `status` is 'registered', or 'waitlisted' when the session is at capacity. account_id is the session course's owning account.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.session.registration.created"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsSessionRegistrationCreatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.session.registration.updated":{"post":{"tags":["Webhooks: LMS"],"summary":"A session registration changed","description":"Fires after a registration row mutation: attendance check-in/out, no-show marking, waitlist promotion. `status` reflects the new value; `changed_fields` lists the columns touched. Cancellations emit `lms.session.registration.cancelled` instead.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.session.registration.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsSessionRegistrationUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.session.registration.cancelled":{"post":{"tags":["Webhooks: LMS"],"summary":"A session registration was cancelled","description":"Fires when a registration is cancelled or deleted outright. When a registered (non-waitlisted) learner cancels, the first waitlisted learner is promoted and receives a `lms.session.registration.updated` event.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.session.registration.cancelled"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsSessionRegistrationCancelledEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.path.created":{"post":{"tags":["Webhooks: LMS"],"summary":"A learning path was created","description":"Fires when an admin creates a new learning path row. Account-scoped to the path's `owner_account_id`.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.path.created"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsPathCreatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.path.updated":{"post":{"tags":["Webhooks: LMS"],"summary":"A learning path was updated","description":"Fires after any mutation to a learning path row. `changed_fields` lists the columns that were touched.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.path.updated"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsPathUpdatedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"lms.path.deleted":{"post":{"tags":["Webhooks: LMS"],"summary":"A learning path was deleted","description":"Fires after a hard-delete of a learning path row. Path enrollments are cascade-deleted; subscribers typically remove the path from caches.","security":[],"parameters":[{"schema":{"type":"string","enum":["lms.path.deleted"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LmsPathDeletedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"loop.thread.replied":{"post":{"tags":["Webhooks: Loop"],"summary":"A reply was posted to a thread","description":"Fires when a message with a non-null `parent_id` is created. `external_id` is the optional WordPress link id from the channel, populated when the thread came from an external integration.","security":[],"parameters":[{"schema":{"type":"string","enum":["loop.thread.replied"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoopThreadRepliedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}},"loop.user.mentioned":{"post":{"tags":["Webhooks: Loop"],"summary":"A user was @-mentioned in a message","description":"Fires for each unique @-mention in a posted message, except self-mentions. The dispatcher delivers one event per mentioned user.","security":[],"parameters":[{"schema":{"type":"string","enum":["loop.user.mentioned"]},"required":true,"name":"X-Agend-Event","in":"header"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"X-Agend-Event-Id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Signature","in":"header"},{"schema":{"type":"string"},"required":true,"name":"X-Agend-Delivery-Attempt","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoopUserMentionedEvent"}}}},"responses":{"2XX":{"description":"Any 2xx response marks the delivery successful. The body is recorded for debugging but not parsed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberAck"}}}},"4XX":{"description":"Subscriber rejected the delivery. The dispatcher records the response body, schedules an exponential-backoff retry, and auto-disables the subscription after 10 consecutive failures."},"5XX":{"description":"Subscriber error. Same retry behaviour as 4xx — back off and try again."}}}}}}