{
  "openapi": "3.1.1",
  "info": {
    "title": "IoTIndia LMS API",
    "version": "1.0.0",
    "summary": "Leads, calls, recordings and events for connected systems.",
    "description": "The IoTIndia LMS public API: submit and manage leads, read calls, recordings and reports, and receive signed events.\n\n- **Authentication**: `Authorization: Bearer lms_<keyId>.<secret>` with a tenant API key created under Settings → Integrations → API keys. Each operation needs one scope.\n- **Workspace operations** live under `/v1/tenants/{tenantSlug}` and run as the key's acting member, so that member's permissions and data visibility also apply.\n- **Errors** share one envelope: `{\"error\": {\"code\", \"message\", \"requestId\"}}`.\n- **Events** arrive as signed webhooks (see `webhooks`) or through the change feed.\n- Operations with the HTTP `QUERY` method are listed under the `x-query` key of their path item, mirroring the `query` field of OpenAPI 3.2.\n\nGuides: `/developers` in the LMS web app.",
    "contact": {
      "name": "IoTIndia developer support",
      "url": "https://iotindia.example/developers"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://iotindia.example/terms"
    }
  },
  "servers": [
    {
      "url": "/",
      "description": "The API origin that serves this document."
    }
  ],
  "security": [
    {
      "apiKey": []
    },
    {
      "partnerToken": []
    }
  ],
  "tags": [
    {
      "name": "Integration",
      "description": "Check the credential you are calling with: its scopes, sources and campaigns."
    },
    {
      "name": "Lead submission",
      "description": "Push leads from your CRM or website into a Partner API source, with your own field names."
    },
    {
      "name": "Change feed",
      "description": "Pull the same events webhooks deliver, in commit order, with a cursor."
    },
    {
      "name": "Recordings",
      "description": "List and download call recordings for the campaigns a key may read."
    },
    {
      "name": "Leads",
      "description": "Work with leads already in LMS: search, read, create in a campaign, update, and log activity."
    },
    {
      "name": "Lead intake",
      "description": "Set up where leads come from: sources, field mappings, routing, imports and intake problems."
    },
    {
      "name": "Ownership",
      "description": "Pipeline stages, segments, segmentation and allocation rules."
    },
    {
      "name": "Calling",
      "description": "Human calling: calls, outcomes, follow-ups, pacing, cohorts and permissions."
    },
    {
      "name": "Reports",
      "description": "Call detail records, summaries, saved templates and exports."
    },
    {
      "name": "Quality",
      "description": "Quality review cases, evaluations, coaching and sales quality."
    },
    {
      "name": "Voicebot",
      "description": "Voicebot call batches, requests and campaign configuration."
    },
    {
      "name": "Campaigns",
      "description": "Campaigns, campaign modules, processes and customer forms."
    },
    {
      "name": "Team",
      "description": "Teams, rosters, members and roles."
    },
    {
      "name": "Administration",
      "description": "Audit log and stored media."
    },
    {
      "name": "Webhooks",
      "description": "Events LMS sends to your HTTPS endpoint, signed with Standard Webhooks."
    }
  ],
  "paths": {
    "/v1/integrations": {
      "get": {
        "operationId": "getIntegrationGrants",
        "summary": "Describe the current credential",
        "description": "Returns what the calling credential may do: its scopes, the sources it may submit to, the campaigns whose recordings it may read, the workspace operations it is granted and whether it can read the change feed. Call this first to check that a new key is set up the way you expect. Needs no particular scope.\n\n**Scope:** any valid credential.",
        "tags": [
          "Integration"
        ],
        "responses": {
          "200": {
            "description": "The credential's grants.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationGrants"
                },
                "example": {
                  "id": "5c6d7e8f-9a0b-4c1d-8e2f-3a4b5c6d7e8f",
                  "kind": "API_KEY",
                  "scopes": [
                    "leads.read",
                    "leads.write",
                    "events.read",
                    "intake.submit"
                  ],
                  "sourceIds": [
                    "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b"
                  ],
                  "recordingCampaignIds": [],
                  "operations": [
                    "GET /lms/leads",
                    "GET /lms/leads/:leadId",
                    "POST /lms/leads"
                  ],
                  "eventFeed": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": []
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": null,
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ]
      }
    },
    "/v1/integrations/event-types": {
      "get": {
        "operationId": "listEventTypes",
        "summary": "List event types",
        "description": "Lists every public event type with its version, group, a one-line summary and an example `data` payload. The same catalogue drives webhook subscriptions and the change feed's `types` filter. Any valid credential may read it; `events.read` is needed only for the change feed itself.\n\n**Scope:** any valid credential.",
        "tags": [
          "Change feed"
        ],
        "responses": {
          "200": {
            "description": "The public event catalogue.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEventCatalogueResponse"
                },
                "example": {
                  "items": [
                    {
                      "type": "lead.created",
                      "version": 1,
                      "group": "Leads",
                      "summary": "A new lead was created from any source.",
                      "example": {
                        "lead": {
                          "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                          "contact": {
                            "name": "Asha Verma",
                            "phone": "+919812345678",
                            "email": "asha@example.com"
                          },
                          "company": "Verma Traders",
                          "city": "Pune",
                          "state": "Maharashtra",
                          "country": "India",
                          "productInterest": "Rooftop solar, 5 kW",
                          "priority": 2,
                          "stage": {
                            "id": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                            "name": "New",
                            "category": "new"
                          },
                          "process": {
                            "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                            "name": "Solar sales"
                          },
                          "campaign": {
                            "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                            "name": "Pune rooftop launch"
                          },
                          "owner": {
                            "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                            "team": {
                              "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                              "name": "West inside sales"
                            }
                          },
                          "source": {
                            "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                            "name": "Meta Lead Ads",
                            "channel": "META"
                          },
                          "receivedAt": "2026-12-01T09:58:12.000Z",
                          "createdAt": "2026-12-01T09:58:13.000Z",
                          "updatedAt": "2026-12-01T10:00:00.000Z"
                        }
                      }
                    },
                    {
                      "type": "lead.updated",
                      "version": 1,
                      "group": "Leads",
                      "summary": "A lead's profile, contacts, campaign or priority changed.",
                      "example": {
                        "changes": [
                          "profile"
                        ],
                        "lead": {
                          "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                          "contact": {
                            "name": "Asha Verma",
                            "phone": "+919812345678",
                            "email": "asha@example.com"
                          },
                          "company": "Verma Traders",
                          "city": "Pune",
                          "state": "Maharashtra",
                          "country": "India",
                          "productInterest": "Rooftop solar, 5 kW",
                          "priority": 2,
                          "stage": {
                            "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                            "name": "Qualified",
                            "category": "qualified"
                          },
                          "process": {
                            "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                            "name": "Solar sales"
                          },
                          "campaign": {
                            "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                            "name": "Pune rooftop launch"
                          },
                          "owner": {
                            "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                            "team": {
                              "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                              "name": "West inside sales"
                            }
                          },
                          "source": {
                            "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                            "name": "Meta Lead Ads",
                            "channel": "META"
                          },
                          "receivedAt": "2026-12-01T09:58:12.000Z",
                          "createdAt": "2026-12-01T09:58:13.000Z",
                          "updatedAt": "2026-12-01T10:00:00.000Z"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": []
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": null,
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ]
      }
    },
    "/v1/integrations/events": {
      "get": {
        "operationId": "listEvents",
        "summary": "Read the change feed",
        "description": "Returns the same events that webhooks deliver, in the order they were committed, so you can poll instead of (or as well as) receiving webhooks. Needs the `events.read` scope.\n\n**Paging.** Start without a cursor (from the oldest retained event) or with `since`. Every response carries `nextCursor`; pass it on the next call. When `hasMore` is `false` you have caught up; poll again later with the same cursor. An empty page still returns a cursor that keeps your position.\n\n**Delivery** is at least once: store the cursor only after you have processed the page, and de-duplicate on the event `id`.\n\n**Retention** is 30 days. A cursor older than that returns `410 CURSOR_EXPIRED`: take a fresh cursor with `since`, then re-read the records you mirror, because events from the gap are gone. The steps are in [Pagination → Retention and recovery](/developers/pagination#retention).\n\n**Scope:** `events.read` (read the change feed).",
        "tags": [
          "Change feed"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The `nextCursor` you saved from the previous page. Leave out to start from `since` or the oldest retained event.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "Without a cursor: start at events at or after this time (ISO 8601). Ignored with a cursor.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Events per page (1–500).",
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "description": "Comma-separated event types to include, for example `lead.created,lead.stage_changed`. All types by default.",
            "schema": {
              "type": "string",
              "maxLength": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of events.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeFeedPage"
                },
                "example": {
                  "data": [
                    {
                      "id": "0f7e6d5c-4b3a-4291-8f7e-000000000001",
                      "type": "lead.created",
                      "version": 1,
                      "timestamp": "2026-12-01T10:00:00.000Z",
                      "workspace": "your-workspace",
                      "data": {
                        "lead": {
                          "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                          "contact": {
                            "name": "Asha Verma",
                            "phone": "+919812345678",
                            "email": "asha@example.com"
                          },
                          "company": "Verma Traders",
                          "city": "Pune",
                          "state": "Maharashtra",
                          "country": "India",
                          "productInterest": "Rooftop solar, 5 kW",
                          "priority": 2,
                          "stage": {
                            "id": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                            "name": "New",
                            "category": "new"
                          },
                          "process": {
                            "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                            "name": "Solar sales"
                          },
                          "campaign": {
                            "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                            "name": "Pune rooftop launch"
                          },
                          "owner": {
                            "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                            "team": {
                              "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                              "name": "West inside sales"
                            }
                          },
                          "source": {
                            "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                            "name": "Meta Lead Ads",
                            "channel": "META"
                          },
                          "receivedAt": "2026-12-01T09:58:12.000Z",
                          "createdAt": "2026-12-01T09:58:13.000Z",
                          "updatedAt": "2026-12-01T10:00:00.000Z"
                        }
                      }
                    },
                    {
                      "id": "0f7e6d5c-4b3a-4291-8f7e-000000000003",
                      "type": "lead.stage_changed",
                      "version": 1,
                      "timestamp": "2026-12-01T10:00:00.000Z",
                      "workspace": "your-workspace",
                      "data": {
                        "previousStage": {
                          "id": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                          "name": "New",
                          "category": "new"
                        },
                        "stage": {
                          "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                          "name": "Qualified",
                          "category": "qualified"
                        },
                        "changedAt": "2026-12-01T10:00:00.000Z",
                        "lead": {
                          "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                          "contact": {
                            "name": "Asha Verma",
                            "phone": "+919812345678",
                            "email": "asha@example.com"
                          },
                          "company": "Verma Traders",
                          "city": "Pune",
                          "state": "Maharashtra",
                          "country": "India",
                          "productInterest": "Rooftop solar, 5 kW",
                          "priority": 2,
                          "stage": {
                            "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                            "name": "Qualified",
                            "category": "qualified"
                          },
                          "process": {
                            "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                            "name": "Solar sales"
                          },
                          "campaign": {
                            "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                            "name": "Pune rooftop launch"
                          },
                          "owner": {
                            "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                            "team": {
                              "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                              "name": "West inside sales"
                            }
                          },
                          "source": {
                            "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                            "name": "Meta Lead Ads",
                            "channel": "META"
                          },
                          "receivedAt": "2026-12-01T09:58:12.000Z",
                          "createdAt": "2026-12-01T09:58:13.000Z",
                          "updatedAt": "2026-12-01T10:00:00.000Z"
                        }
                      }
                    }
                  ],
                  "nextCursor": "eyJzIjo0MjEsInQiOjE3OTY4MTg0MDAwMDB9",
                  "hasMore": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "events.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "events.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_SCOPE_FORBIDDEN",
            "when": "The key lacks the `events.read` scope."
          },
          {
            "status": 410,
            "code": "CURSOR_EXPIRED",
            "when": "The cursor is older than the 30-day retention. Take a fresh cursor and reconcile mirrored records: [Retention and recovery](/developers/pagination#retention)."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ]
      }
    },
    "/v1/integrations/sources/{sourceId}/leads": {
      "post": {
        "operationId": "submitLead",
        "summary": "Submit a lead",
        "description": "Sends one lead to a **Partner API** source. LMS applies the source's published field mapping and routing, de-duplicates against existing leads and returns a receipt. Needs the `intake.submit` scope with this source selected on the key.\n\nSend an `Idempotency-Key`. Retrying with the same key and body returns the original receipt; the same key with a different body returns `409 IDEMPOTENCY_CONFLICT`. Records that cannot be mapped or routed yet are held (`NEEDS_MAPPING`, `NEEDS_ROUTING`, `leadId: null`) and replayed by an operator once the source is fixed. The saved receipt does not change after that replay; follow the lead through `lead.created` or the change feed.\n\nUse this to push leads from another system with its own field names. To create a lead directly in a campaign you choose, with LMS field names, use **Create a lead**.\n\n**Scope:** `intake.submit` (submit leads).",
        "tags": [
          "Lead submission"
        ],
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "description": "Partner API source ID: one of the `sourceIds` that [Describe the current credential](#getIntegrationGrants) returns. Sources are set up in LMS under Lead intake → Sources.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerIntakeRequest"
              },
              "example": {
                "externalRecordId": "crm-123",
                "fields": {
                  "name": "Asha Verma",
                  "phone": "+919812345678",
                  "email": "asha@example.com",
                  "city": "Pune",
                  "product": "Rooftop solar, 5 kW"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The submission's receipt (the original one on a retry). Look it up later with **Get a submission receipt**.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerIntakeReceipt"
                },
                "examples": {
                  "default": {
                    "summary": "Lead created",
                    "value": {
                      "id": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
                      "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                      "sourceRecordId": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",
                      "status": "MATERIALIZED",
                      "reasonCode": "LEAD_CREATED"
                    }
                  },
                  "held": {
                    "summary": "Held for mapping",
                    "value": {
                      "id": "c3d4e5f6-a7b8-4c9d-8e0f-2a3b4c5d6e7f",
                      "leadId": null,
                      "sourceRecordId": "5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b",
                      "status": "NEEDS_MAPPING",
                      "reasonCode": "MAPPING_VERSION_NOT_FOUND"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.submit"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.submit",
        "x-errors": [
          {
            "status": 400,
            "code": "IDEMPOTENCY_KEY_REQUIRED",
            "when": "The `Idempotency-Key` header is missing."
          },
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_SCOPE_FORBIDDEN",
            "when": "The key lacks the `intake.submit` scope."
          },
          {
            "status": 404,
            "code": "SOURCE_NOT_FOUND",
            "when": "The source does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "IDEMPOTENCY_CONFLICT",
            "when": "The `Idempotency-Key` was already used with a different body."
          },
          {
            "status": 409,
            "code": "SOURCE_INACTIVE",
            "when": "The source is paused; resume it, then resend with the same key."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ]
      }
    },
    "/v1/integrations/sources/{sourceId}/receipts/{receiptId}": {
      "get": {
        "operationId": "getLeadReceipt",
        "summary": "Get a submission receipt",
        "description": "Returns the saved outcome of an earlier submission to this source. Receipts record the result at submission time; later routing or replay happens in the LMS intake workspace. Needs the `intake.submit` scope with this source selected.\n\n**Scope:** `intake.submit` (submit leads).",
        "tags": [
          "Lead submission"
        ],
        "parameters": [
          {
            "name": "sourceId",
            "in": "path",
            "required": true,
            "description": "Partner API source ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "receiptId",
            "in": "path",
            "required": true,
            "description": "Receipt ID returned by the submission.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The receipt.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerIntakeReceipt"
                },
                "example": {
                  "id": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "sourceRecordId": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",
                  "status": "MATERIALIZED",
                  "reasonCode": "LEAD_CREATED"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.submit"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.submit",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_SCOPE_FORBIDDEN",
            "when": "The key lacks the `intake.submit` scope."
          },
          {
            "status": 404,
            "code": "SOURCE_NOT_FOUND",
            "when": "The source does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "RECEIPT_NOT_FOUND",
            "when": "The receipt does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ]
      }
    },
    "/v1/integrations/calls/{callId}/recordings": {
      "get": {
        "operationId": "listCallRecordings",
        "summary": "List a call's recordings",
        "description": "Lists the recordings of a human call that are ready to download. Needs the `recordings.read` scope with the call's campaign selected on the key. Calls in other campaigns return `404`, so the response never reveals whether they exist. Subscribe to `recording.available` to learn when to call this.\n\n**Scope:** `recordings.read` (read call recordings).",
        "tags": [
          "Recordings"
        ],
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call ID (from a call event).",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Downloadable recordings.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerRecordingList"
                },
                "example": {
                  "items": [
                    {
                      "id": "rec_01HZX4",
                      "type": "STEREO_MASTER",
                      "format": "wav"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "recordings.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "recordings.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_SCOPE_FORBIDDEN",
            "when": "The key lacks the `recordings.read` scope."
          },
          {
            "status": 404,
            "code": "RECORDING_NOT_FOUND",
            "when": "The call or recording does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 502,
            "code": null,
            "when": "Telephony returned an error; `error.code` names it. Retry shortly."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ]
      }
    },
    "/v1/integrations/calls/{callId}/recordings/{recordingId}/content": {
      "get": {
        "operationId": "downloadCallRecording",
        "summary": "Download a recording",
        "description": "Streams the audio of a listed recording. Send a single `Range: bytes=…` header to resume a download or seek; the response is then `206 Partial Content`. Needs the `recordings.read` scope with the call's campaign selected.\n\n**Scope:** `recordings.read` (read call recordings).",
        "tags": [
          "Recordings"
        ],
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "recordingId",
            "in": "path",
            "required": true,
            "description": "Recording ID from the recording list.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
            }
          },
          {
            "name": "Range",
            "in": "header",
            "required": false,
            "description": "One byte range, for example `bytes=0-1048575`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The whole recording.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Accept-Ranges": {
                "description": "Always `bytes`.",
                "schema": {
                  "type": "string"
                }
              },
              "Content-Length": {
                "description": "Size of the audio in bytes.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "audio/wav"
                }
              }
            }
          },
          "206": {
            "description": "The requested byte range.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Content-Range": {
                "description": "The range returned and the full size, for example `bytes 0-1048575/5242880`.",
                "schema": {
                  "type": "string"
                }
              },
              "Content-Length": {
                "description": "Size of this part in bytes.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "audio/wav"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "recordings.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "recordings.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_SCOPE_FORBIDDEN",
            "when": "The key lacks the `recordings.read` scope."
          },
          {
            "status": 404,
            "code": "RECORDING_NOT_FOUND",
            "when": "The call or recording does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 502,
            "code": null,
            "when": "Telephony returned an error; `error.code` names it. Retry shortly."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ]
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads": {
      "get": {
        "operationId": "listLeads",
        "summary": "List leads",
        "description": "Searches and filters leads. Filters combine with AND. Results are sorted by received time (newest first by default) and paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`. Leads outside the acting member's data visibility are never returned. For long filter lists, use the `QUERY` form of this operation with a JSON body instead.\n\n**Scope:** `leads.read` (read leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to look for in the lead's name, company, phone numbers and email addresses. Partial and case-insensitive: `asha` matches `Asha Verma`, `98123` matches `+919812345678`.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "firstTouchSource",
            "in": "query",
            "required": false,
            "description": "Only leads whose first enquiry came from this kind of source, by source type key (for example `meta_lead_ads` or `website_form`; see List source types).",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            }
          },
          {
            "name": "lastTouchSource",
            "in": "query",
            "required": false,
            "description": "Only leads whose latest enquiry came from this kind of source, by source type key.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            }
          },
          {
            "name": "assignedTeamId",
            "in": "query",
            "required": false,
            "description": "Only leads owned by this team.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignedUserId",
            "in": "query",
            "required": false,
            "description": "Only leads owned by this member (user ID).",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignmentState",
            "in": "query",
            "required": false,
            "description": "Whose leads: `MY_LEADS` (owned by the API key's acting member), `MY_TEAM` (owned by that member's teams), `UNASSIGNED` (no team yet) or `ALL`.",
            "schema": {
              "default": "ALL",
              "type": "string",
              "enum": [
                "MY_LEADS",
                "MY_TEAM",
                "UNASSIGNED",
                "ALL"
              ]
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "description": "Only leads in this campaign.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "segmentId",
            "in": "query",
            "required": false,
            "description": "Only leads in this segment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "currentStageId",
            "in": "query",
            "required": false,
            "description": "Only leads currently in this pipeline stage.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "processId",
            "in": "query",
            "required": false,
            "description": "Only leads in this sales process.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "providerSubmittedFrom",
            "in": "query",
            "required": false,
            "description": "Only leads the sending system (for example Meta) says were submitted at or after this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "providerSubmittedTo",
            "in": "query",
            "required": false,
            "description": "Only leads submitted, per the sending system, at or before this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "receivedFrom",
            "in": "query",
            "required": false,
            "description": "Only leads LMS received at or after this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "receivedTo",
            "in": "query",
            "required": false,
            "description": "Only leads LMS received at or before this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sourceConnectionId",
            "in": "query",
            "required": false,
            "description": "Only leads that arrived through this source.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "stageCategory",
            "in": "query",
            "required": false,
            "description": "Only leads whose stage has this meaning, whatever the stage is called in each process.",
            "schema": {
              "type": "string",
              "enum": [
                "NEW",
                "OPEN",
                "CONTACTED",
                "QUALIFIED",
                "CONVERTED",
                "LOST",
                "DISQUALIFIED"
              ]
            }
          },
          {
            "name": "stageScope",
            "in": "query",
            "required": false,
            "description": "`open` keeps only leads still being worked (`NEW`, `OPEN`, `CONTACTED` or `QUALIFIED` stages).",
            "schema": {
              "type": "string",
              "const": "open"
            }
          },
          {
            "name": "sla",
            "in": "query",
            "required": false,
            "description": "Only leads with a running SLA clock in this state: `AT_RISK` (due soon) or `BREACHED` (overdue).",
            "schema": {
              "type": "string",
              "enum": [
                "AT_RISK",
                "BREACHED"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "`received-desc` (newest first) or `received-asc` (oldest first), by the time LMS received the lead.",
            "schema": {
              "default": "received-desc",
              "type": "string",
              "enum": [
                "received-desc",
                "received-asc"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of leads.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/leads"
      },
      "x-query": {
        "operationId": "queryLeads",
        "summary": "Query leads",
        "description": "Same as **List leads**, with the filters sent as a JSON body using the HTTP `QUERY` method (safe and idempotent, like `GET`). Send `Content-Type: application/json`. Filters combine with AND. Results are sorted by received time (newest first by default) and paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`. Leads outside the acting member's data visibility are never returned.\n\n**Scope:** `leads.read` (read leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadListQuery"
              },
              "example": {
                "stageCategory": "QUALIFIED",
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "limit": 50
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One page of leads.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableContent"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 415,
            "code": "QUERY_CONTENT_TYPE_UNSUPPORTED",
            "when": "The `QUERY` request has no `Content-Type: application/json` body."
          },
          {
            "status": 422,
            "code": "QUERY_VALIDATION_FAILED",
            "when": "The `QUERY` body is JSON but does not match the request fields."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "QUERY /lms/leads"
      },
      "post": {
        "operationId": "createLead",
        "summary": "Create a lead",
        "description": "Creates a lead directly in a campaign, applying the campaign's process, initial stage, segmentation and allocation rules. Provide at least a name, a company, or a phone, email or WhatsApp contact.\n\nIf the lead matches an existing one under the process's identity rules, no new lead is created: the response has `created: false`, the existing `leadId` and `repeatEnquiry: true`, and a `lead.repeat_enquiry` event is published.\n\n`Idempotency-Key` is required and must be a UUID for this operation. Retrying with the same key returns the original result.\n\nTo feed leads from another system with your own field names and routing, prefer **Submit a lead** to a Partner API source.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSelfLeadRequest"
              },
              "example": {
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "fullName": "Asha Verma",
                "companyName": "Verma Traders",
                "city": "Pune",
                "state": "Maharashtra",
                "country": "India",
                "productInterest": "Rooftop solar, 5 kW",
                "priority": "HIGH",
                "contacts": [
                  {
                    "contactType": "PHONE",
                    "value": "+919812345678",
                    "isPrimary": true
                  },
                  {
                    "contactType": "EMAIL",
                    "value": "asha@example.com"
                  }
                ],
                "customAttributes": {
                  "budget": "3-4 lakh"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The lead matched an existing lead, or the request was a retry.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateLeadResponse"
                },
                "example": {
                  "created": false,
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "repeatEnquiry": true
                }
              }
            }
          },
          "201": {
            "description": "A new lead was created.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Location": {
                "description": "URL of the new lead.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateLeadResponse"
                },
                "example": {
                  "created": true,
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "IDEMPOTENCY_KEY_REQUIRED",
            "when": "The `Idempotency-Key` header is missing."
          },
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 409,
            "code": "IDEMPOTENCY_CONFLICT",
            "when": "The `Idempotency-Key` was already used with a different body."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/export": {
      "get": {
        "operationId": "exportLeads",
        "summary": "Export leads",
        "description": "Returns the same page as **List leads** as a downloadable JSON attachment. Needs the export permission on the acting member. Filters combine with AND. Results are sorted by received time (newest first by default) and paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`. Leads outside the acting member's data visibility are never returned.\n\n**Scope:** `leads.read` (read leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to look for in the lead's name, company, phone numbers and email addresses. Partial and case-insensitive: `asha` matches `Asha Verma`, `98123` matches `+919812345678`.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "firstTouchSource",
            "in": "query",
            "required": false,
            "description": "Only leads whose first enquiry came from this kind of source, by source type key (for example `meta_lead_ads` or `website_form`; see List source types).",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            }
          },
          {
            "name": "lastTouchSource",
            "in": "query",
            "required": false,
            "description": "Only leads whose latest enquiry came from this kind of source, by source type key.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            }
          },
          {
            "name": "assignedTeamId",
            "in": "query",
            "required": false,
            "description": "Only leads owned by this team.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignedUserId",
            "in": "query",
            "required": false,
            "description": "Only leads owned by this member (user ID).",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignmentState",
            "in": "query",
            "required": false,
            "description": "Whose leads: `MY_LEADS` (owned by the API key's acting member), `MY_TEAM` (owned by that member's teams), `UNASSIGNED` (no team yet) or `ALL`.",
            "schema": {
              "default": "ALL",
              "type": "string",
              "enum": [
                "MY_LEADS",
                "MY_TEAM",
                "UNASSIGNED",
                "ALL"
              ]
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "description": "Only leads in this campaign.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "segmentId",
            "in": "query",
            "required": false,
            "description": "Only leads in this segment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "currentStageId",
            "in": "query",
            "required": false,
            "description": "Only leads currently in this pipeline stage.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "processId",
            "in": "query",
            "required": false,
            "description": "Only leads in this sales process.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "providerSubmittedFrom",
            "in": "query",
            "required": false,
            "description": "Only leads the sending system (for example Meta) says were submitted at or after this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "providerSubmittedTo",
            "in": "query",
            "required": false,
            "description": "Only leads submitted, per the sending system, at or before this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "receivedFrom",
            "in": "query",
            "required": false,
            "description": "Only leads LMS received at or after this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "receivedTo",
            "in": "query",
            "required": false,
            "description": "Only leads LMS received at or before this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sourceConnectionId",
            "in": "query",
            "required": false,
            "description": "Only leads that arrived through this source.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "stageCategory",
            "in": "query",
            "required": false,
            "description": "Only leads whose stage has this meaning, whatever the stage is called in each process.",
            "schema": {
              "type": "string",
              "enum": [
                "NEW",
                "OPEN",
                "CONTACTED",
                "QUALIFIED",
                "CONVERTED",
                "LOST",
                "DISQUALIFIED"
              ]
            }
          },
          {
            "name": "stageScope",
            "in": "query",
            "required": false,
            "description": "`open` keeps only leads still being worked (`NEW`, `OPEN`, `CONTACTED` or `QUALIFIED` stages).",
            "schema": {
              "type": "string",
              "const": "open"
            }
          },
          {
            "name": "sla",
            "in": "query",
            "required": false,
            "description": "Only leads with a running SLA clock in this state: `AT_RISK` (due soon) or `BREACHED` (overdue).",
            "schema": {
              "type": "string",
              "enum": [
                "AT_RISK",
                "BREACHED"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "`received-desc` (newest first) or `received-asc` (oldest first), by the time LMS received the lead.",
            "schema": {
              "default": "received-desc",
              "type": "string",
              "enum": [
                "received-desc",
                "received-asc"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of leads as an attachment.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Content-Disposition": {
                "description": "Always `attachment; filename=\"iotindia-lms-leads.json\"`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/leads/export"
      },
      "x-query": {
        "operationId": "queryLeadExport",
        "summary": "Export leads (query)",
        "description": "Same as **Export leads**, with the filters sent as a JSON body using the HTTP `QUERY` method. Returns up to 100 leads per page.\n\n**Scope:** `leads.read` (read leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadListQuery"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One page of leads as an attachment.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Content-Disposition": {
                "description": "Always `attachment; filename=\"iotindia-lms-leads.json\"`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableContent"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 415,
            "code": "QUERY_CONTENT_TYPE_UNSUPPORTED",
            "when": "The `QUERY` request has no `Content-Type: application/json` body."
          },
          {
            "status": 422,
            "code": "QUERY_VALIDATION_FAILED",
            "when": "The `QUERY` body is JSON but does not match the request fields."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "QUERY /lms/leads/export"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}": {
      "get": {
        "operationId": "getLead",
        "summary": "Get a lead",
        "description": "Returns the full lead record: identity, contacts, acquisition (source and touches), lifecycle stage, ownership and recent history. Use its `updatedAt` as `expectedUpdatedAt` when you change the lead.\n\n**Scope:** `leads.read` (read leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The lead.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadDetailResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/leads/{leadId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/profile": {
      "patch": {
        "operationId": "updateLeadProfile",
        "summary": "Update a lead's profile",
        "description": "Changes profile fields. Send only the fields to change; `null` clears a field. Send the lead's current `updatedAt` as `expectedUpdatedAt`. If someone changed the lead in the meantime the request fails with `409` and nothing is saved: read the lead again and retry.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateLeadProfileRequest"
              },
              "example": {
                "expectedUpdatedAt": "2026-12-01T10:00:00.000Z",
                "city": "Mumbai",
                "priority": "URGENT"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved profile version.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadProfileResponse"
                },
                "example": {
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "priority": 4,
                  "updatedAt": "2026-12-01T10:05:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_LEAD",
            "when": "The lead changed after your read (`expectedUpdatedAt`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/leads/{leadId}/profile"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/contacts": {
      "post": {
        "operationId": "addLeadContact",
        "summary": "Add a contact",
        "description": "Adds a phone number, email address, WhatsApp number or other contact. Phone numbers are normalised; `isPrimary: true` makes it the primary contact of its type. Send the lead's current `updatedAt` as `expectedUpdatedAt`. If someone changed the lead in the meantime the request fails with `409` and nothing is saved: read the lead again and retry.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadContactCreateRequest"
              },
              "example": {
                "expectedUpdatedAt": "2026-12-01T10:00:00.000Z",
                "contactType": "WHATSAPP",
                "value": "+919812345678",
                "label": "Personal",
                "isPrimary": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new contact.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadContactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_LEAD",
            "when": "The lead changed after your read (`expectedUpdatedAt`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/contacts"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/contacts/{contactId}": {
      "patch": {
        "operationId": "updateLeadContact",
        "summary": "Update a contact's label or primary flag",
        "description": "Changes a contact's label or makes it primary. To change the number or address itself, use **Replace a contact**. Send the lead's current `updatedAt` as `expectedUpdatedAt`. If someone changed the lead in the meantime the request fails with `409` and nothing is saved: read the lead again and retry.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadContactMetadataRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated contact.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadContactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "CONTACT_NOT_FOUND",
            "when": "The contact does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_LEAD",
            "when": "The lead changed after your read (`expectedUpdatedAt`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/leads/{leadId}/contacts/{contactId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/contacts/{contactId}/replace": {
      "post": {
        "operationId": "replaceLeadContact",
        "summary": "Replace a contact",
        "description": "Replaces a contact's value. The old value is kept in history as removed and a new contact is returned. Send the lead's current `updatedAt` as `expectedUpdatedAt`. If someone changed the lead in the meantime the request fails with `409` and nothing is saved: read the lead again and retry.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadContactReplaceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The replacement contact.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadContactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "CONTACT_NOT_FOUND",
            "when": "The contact does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_LEAD",
            "when": "The lead changed after your read (`expectedUpdatedAt`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/contacts/{contactId}/replace"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/contacts/{contactId}/deactivate": {
      "post": {
        "operationId": "removeLeadContact",
        "summary": "Remove a contact",
        "description": "Marks a contact as removed. It stays in history but is no longer used for calls or messages. Send the lead's current `updatedAt` as `expectedUpdatedAt`. If someone changed the lead in the meantime the request fails with `409` and nothing is saved: read the lead again and retry.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadContactDeactivateRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The contact was removed.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "CONTACT_NOT_FOUND",
            "when": "The contact does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_LEAD",
            "when": "The lead changed after your read (`expectedUpdatedAt`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/contacts/{contactId}/deactivate"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/activities": {
      "post": {
        "operationId": "addLeadActivity",
        "summary": "Log an activity",
        "description": "Records a contact attempt, a note or a follow-up on the lead's timeline. A `FOLLOW_UP` with `dueAt` schedules a follow-up and publishes `followup.created`.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadActivityInput"
              },
              "example": {
                "activityType": "FOLLOW_UP",
                "channel": "PHONE",
                "dueAt": "2026-12-02T05:30:00.000Z",
                "note": "Call back with the revised quote.",
                "occurredAt": "2026-12-01T10:00:00.000Z"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The recorded activity.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadActivityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/activities"
      },
      "x-query": {
        "operationId": "queryLeadActivities",
        "summary": "Query a lead's activities",
        "description": "Lists the lead's timeline, newest first, filtered by activity type, channel and time range, using the HTTP `QUERY` method with a JSON body. Page with `cursor` / `nextCursor`. Voided activities are excluded unless `includeVoided` is `true`.\n\n**Scope:** `leads.read` (read leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadActivityQuery"
              },
              "example": {
                "activityTypes": [
                  "CONTACT",
                  "FOLLOW_UP"
                ],
                "limit": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One page of activities.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadActivityPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableContent"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 415,
            "code": "QUERY_CONTENT_TYPE_UNSUPPORTED",
            "when": "The `QUERY` request has no `Content-Type: application/json` body."
          },
          {
            "status": 422,
            "code": "QUERY_VALIDATION_FAILED",
            "when": "The `QUERY` body is JSON but does not match the request fields."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "QUERY /lms/leads/{leadId}/activities"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/activities/{activityId}": {
      "patch": {
        "operationId": "correctLeadActivity",
        "summary": "Correct an activity",
        "description": "Replaces an activity with a corrected version and records why. Send the activity's current `revision` as `expectedRevision`; a stale revision returns `409`.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "activityId",
            "in": "path",
            "required": true,
            "description": "Activity ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CorrectLeadActivityRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The corrected activity.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadActivityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "ACTIVITY_NOT_FOUND",
            "when": "The activity does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/leads/{leadId}/activities/{activityId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/activities/{activityId}/void": {
      "post": {
        "operationId": "voidLeadActivity",
        "summary": "Void an activity",
        "description": "Marks an activity as void (for example, logged on the wrong lead). It stays in history for audit. Send the current `revision` as `expectedRevision`.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "activityId",
            "in": "path",
            "required": true,
            "description": "Activity ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoidLeadActivityRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The activity was voided.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "ACTIVITY_NOT_FOUND",
            "when": "The activity does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/activities/{activityId}/void"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/transition": {
      "post": {
        "operationId": "transitionLeadStage",
        "summary": "Move a lead to another stage",
        "description": "Moves the lead to a stage of its process, subject to the process's transition rules. Publishes `lead.stage_changed`. `reason` is an upper-case code you choose (for example `CRM_SYNC`) that is stored in the lead's history.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionLeadRequest"
              },
              "example": {
                "stageId": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                "reason": "CRM_SYNC"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The transition that was applied.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadTransitionResponse"
                },
                "example": {
                  "isFirstConversion": false,
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "occurredAt": "2026-12-01T10:00:00.000Z",
                  "previousStageCategory": "NEW",
                  "previousStageId": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                  "stageCategory": "QUALIFIED",
                  "stageId": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/transition"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/assignment": {
      "post": {
        "operationId": "assignLead",
        "summary": "Assign a lead",
        "description": "Assigns the lead to a team and, optionally, a member of that team (`userId: null` leaves it in the team queue). A manual assignment locks ownership so allocation rules no longer change it; clear the lock to hand control back to the rules. Publishes `lead.assigned`. `reason` is an upper-case code you choose (for example `CRM_SYNC`) that is stored in the lead's history.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignLeadRequest"
              },
              "example": {
                "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                "reason": "CRM_OWNER_SYNC"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The lead's ownership after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadOwnershipResponse"
                },
                "example": {
                  "assignmentLocked": true,
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "segmentId": null,
                  "segmentLocked": false,
                  "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/assignment"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/assignment-lock/clear": {
      "post": {
        "operationId": "clearLeadAssignmentLock",
        "summary": "Release a manual assignment",
        "description": "Clears the assignment lock so allocation rules may reassign the lead on their next evaluation. `reason` is an upper-case code you choose (for example `CRM_SYNC`) that is stored in the lead's history.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClearLeadLockRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The lead's ownership after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadOwnershipResponse"
                },
                "example": {
                  "assignmentLocked": true,
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "segmentId": null,
                  "segmentLocked": false,
                  "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/assignment-lock/clear"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/segment": {
      "post": {
        "operationId": "setLeadSegment",
        "summary": "Set a lead's segment",
        "description": "Places the lead in a segment (or none with `segmentId: null`) and locks the choice against segmentation rules. `reason` is an upper-case code you choose (for example `CRM_SYNC`) that is stored in the lead's history.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetLeadSegmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The lead's ownership after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadOwnershipResponse"
                },
                "example": {
                  "assignmentLocked": true,
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "segmentId": null,
                  "segmentLocked": false,
                  "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/segment"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/segment-lock/clear": {
      "post": {
        "operationId": "clearLeadSegmentLock",
        "summary": "Release a manual segment",
        "description": "Clears the segment lock so segmentation rules apply again. `reason` is an upper-case code you choose (for example `CRM_SYNC`) that is stored in the lead's history.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClearLeadLockRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The lead's ownership after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadOwnershipResponse"
                },
                "example": {
                  "assignmentLocked": true,
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "segmentId": null,
                  "segmentLocked": false,
                  "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/segment-lock/clear"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/reevaluate": {
      "post": {
        "operationId": "reevaluateLead",
        "summary": "Re-run ownership rules",
        "description": "Re-applies the published segmentation and allocation rules to the lead now. Locked choices are kept. `reason` is an upper-case code you choose (for example `CRM_SYNC`) that is stored in the lead's history.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClearLeadLockRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ownership after re-evaluation, with what changed.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadReevaluationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/reevaluate"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/campaign": {
      "post": {
        "operationId": "moveLeadCampaign",
        "summary": "Move a lead to another campaign",
        "description": "Moves the lead to another campaign of the same process. Ownership is re-evaluated for the new campaign. `reason` is an upper-case code you choose (for example `CRM_SYNC`) that is stored in the lead's history.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveLeadCampaignRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The lead's ownership after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadOwnershipResponse"
                },
                "example": {
                  "assignmentLocked": true,
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "segmentId": null,
                  "segmentLocked": false,
                  "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/leads/{leadId}/campaign"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/customer-fields": {
      "get": {
        "operationId": "getLeadCustomerFields",
        "summary": "Get a lead's customer fields",
        "description": "Returns the values of the campaign's customer form for this lead, with the form revision they were saved against.\n\n**Scope:** `leads.read` (read leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer field values.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerFieldValuesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/leads/{leadId}/customer-fields"
      },
      "put": {
        "operationId": "saveLeadCustomerFields",
        "summary": "Save a lead's customer fields",
        "description": "Saves values for the campaign's customer form. Values are validated against the form's field types and required fields; send the form revision you read so a changed form is detected.\n\n**Scope:** `leads.write` (change leads).",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCustomerFieldValues"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved values.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerFieldValuesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "leads.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "leads.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `leads.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_LEAD",
            "when": "The lead changed after your read (`expectedUpdatedAt`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/leads/{leadId}/customer-fields"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/source-definitions": {
      "get": {
        "operationId": "listSourceDefinitions",
        "summary": "List source types",
        "description": "Lists the kinds of lead source you can connect (for example Meta Lead Ads, IndiaMART, Justdial or a website webhook), with how each one connects and what it needs before it can be used. Use a definition's `key` as `sourceDefinitionKey` when you create a source connection. Deprecated types are not returned.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "Active source types.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadSourceDefinition"
                  }
                },
                "example": [
                  {
                    "availability": "APP_APPROVAL_REQUIRED",
                    "channelCapabilities": [
                      "FACEBOOK",
                      "INSTAGRAM"
                    ],
                    "connectionMechanism": "WEBHOOK",
                    "credentialMechanism": "SECRET_REFERENCE",
                    "displayName": "Meta Lead Ads",
                    "key": "meta_lead_ads",
                    "maximumContractVersion": 1,
                    "minimumContractVersion": 1,
                    "provider": "META",
                    "status": "ACTIVE"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/source-definitions"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/source-connections": {
      "get": {
        "operationId": "listSourceConnections",
        "summary": "List source connections",
        "description": "Lists every source connection in the workspace, oldest first. Configuration keys that look like credentials are never returned; `secretConfigured` tells you whether a credential is attached.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "All source connections.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadSourceConnection"
                  }
                },
                "example": [
                  {
                    "configuration": {
                      "pollIntervalMinutes": 15
                    },
                    "createdAt": "2026-11-28T09:15:00.000Z",
                    "defaultCampaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                    "externalAccountId": "GLID-4471923",
                    "externalAccountName": "Verma Solar Solutions",
                    "id": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                    "name": "IndiaMART · Pune",
                    "secretConfigured": true,
                    "sourceDefinitionKey": "indiamart",
                    "status": "ACTIVE",
                    "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/source-connections"
      },
      "post": {
        "operationId": "createSourceConnection",
        "summary": "Create a source connection",
        "description": "Connects a lead source of an active source type (see **List source types**). New connections start in `DRAFT`; set `status` to `ACTIVE` with **Update a source connection** once the mapping and routing are published.\n\n- `configuration` holds non-secret provider settings. A key that looks like a credential (`token`, `password`, `secret`, `apiKey`, `accessToken`) is rejected with `400`.\n- `secretReference` attaches a credential your LMS administrator has stored in the platform's secret manager; it must be a secret-manager ARN and is never returned.\n- `defaultCampaignId` is where records go when no routing rule matches.\n\nAn unknown or deprecated `sourceDefinitionKey` returns `404`. Connection names are unique among active connections: a duplicate name returns `409`.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSourceConnectionRequest"
              },
              "example": {
                "sourceDefinitionKey": "indiamart",
                "name": "IndiaMART · Pune",
                "externalAccountId": "GLID-4471923",
                "externalAccountName": "Verma Solar Solutions",
                "defaultCampaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "configuration": {
                  "pollIntervalMinutes": 15
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new source connection, in `DRAFT`.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Location": {
                "description": "URL of the new source connection.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSourceConnection"
                },
                "example": {
                  "configuration": {
                    "pollIntervalMinutes": 15
                  },
                  "createdAt": "2026-11-28T09:15:00.000Z",
                  "defaultCampaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "externalAccountId": "GLID-4471923",
                  "externalAccountName": "Verma Solar Solutions",
                  "id": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                  "name": "IndiaMART · Pune",
                  "secretConfigured": false,
                  "sourceDefinitionKey": "indiamart",
                  "status": "DRAFT",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "SOURCE_CONNECTION_NAME_CONFLICT",
            "when": "Another source connection already has this name."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/source-connections"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/source-connections/{connectionId}": {
      "get": {
        "operationId": "getSourceConnection",
        "summary": "Get a source connection",
        "description": "Returns one source connection: its source type, status, default campaign and non-secret configuration.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "description": "Source connection ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The source connection.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSourceConnection"
                },
                "example": {
                  "configuration": {
                    "pollIntervalMinutes": 15
                  },
                  "createdAt": "2026-11-28T09:15:00.000Z",
                  "defaultCampaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "externalAccountId": "GLID-4471923",
                  "externalAccountName": "Verma Solar Solutions",
                  "id": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                  "name": "IndiaMART · Pune",
                  "secretConfigured": true,
                  "sourceDefinitionKey": "indiamart",
                  "status": "ACTIVE",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "SOURCE_CONNECTION_NOT_FOUND",
            "when": "The source connection does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/source-connections/{connectionId}"
      },
      "patch": {
        "operationId": "updateSourceConnection",
        "summary": "Update a source connection",
        "description": "Changes a connection's name, account details, default campaign, configuration, credential reference or `status` (`ACTIVE`, `PAUSED`, `ARCHIVED`, …). Send only the fields to change; `null` clears a nullable field. `configuration`, when sent, replaces the whole object and follows the same no-secrets rule as on create. A name already used by another active connection returns `409`.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "description": "Source connection ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSourceConnectionRequest"
              },
              "example": {
                "status": "ACTIVE",
                "defaultCampaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated source connection.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSourceConnection"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "SOURCE_CONNECTION_NOT_FOUND",
            "when": "The source connection does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "SOURCE_CONNECTION_NAME_CONFLICT",
            "when": "Another source connection already has this name."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/source-connections/{connectionId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/source-health": {
      "get": {
        "operationId": "listSourceHealth",
        "summary": "Get source health",
        "description": "Returns delivery and processing counters for each source connection: records received, accepted, duplicates, rejected, waiting for mapping or routing, and the last success and failure. Filter to one connection with `sourceConnectionId`.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "sourceConnectionId",
            "in": "query",
            "required": false,
            "description": "ID of the source connection.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Health per source connection.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SourceHealthResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/source-health"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/source-health/directory": {
      "get": {
        "operationId": "searchSourceHealth",
        "summary": "Search source health",
        "description": "Same counters as **Get source health**, with the source type's display name, sorted by connection name and paged by page number (50 per page; follow `hasNextPage`). `q` matches the connection or source type name. Archived connections are excluded unless `includeArchived=1`. `hasSources` is `false` only when the workspace has no sources at all, which helps you tell an empty search from an empty workspace.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "description": "Include archived records (they are left out by default).",
            "schema": {
              "default": "0",
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, starting at 1.",
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 2147483647
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Free-text search; matches names and other visible text, case-insensitively.",
            "schema": {
              "type": "string",
              "maxLength": 200,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of source health.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceHealthDirectoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/source-health/directory"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/mappings/{mappingId}": {
      "get": {
        "operationId": "getMapping",
        "summary": "Get a field mapping",
        "description": "Returns the current draft of a field mapping. The response is the mapping draft: `id`, `name`, `sourceConnectionId`, `rules`, `revision`, `status` (`ACTIVE` or `ARCHIVED`), `tenantId`, `createdAt` and `updatedAt`. Use `revision` as `expectedRevision` when you update or publish it.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "mappingId",
            "in": "path",
            "required": true,
            "description": "Field mapping ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The mapping draft.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MappingDraft"
                },
                "example": {
                  "id": "e3f4a5b6-c7d8-4e9f-8a0b-1c2d3e4f5a6b",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "name": "IndiaMART enquiry fields",
                  "revision": 3,
                  "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                  "status": "ACTIVE",
                  "rules": [
                    {
                      "sourceField": "SENDER_NAME",
                      "targetField": "lead.fullName",
                      "required": true,
                      "transform": "TRIM"
                    },
                    {
                      "sourceField": "SENDER_MOBILE",
                      "targetField": "identity.phone",
                      "required": true,
                      "transform": "NONE"
                    },
                    {
                      "sourceField": "QUERY_TYPE",
                      "targetField": "attribution.channel",
                      "required": true,
                      "transform": "UPPERCASE"
                    },
                    {
                      "sourceField": "SENDER_STATE",
                      "targetField": "routing.state",
                      "required": false,
                      "transform": "TRIM"
                    }
                  ],
                  "createdAt": "2026-11-20T06:30:00.000Z",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "MAPPING_NOT_FOUND",
            "when": "The field mapping does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/mappings/{mappingId}"
      },
      "patch": {
        "operationId": "updateMapping",
        "summary": "Update a field mapping draft",
        "description": "Renames the draft or replaces its whole `rules` list; send at least one of the two. Each save increases `revision`. Send the draft's current `revision` as `expectedRevision`. If someone changed the draft since you read it, the request fails with `409` (`STALE_REVISION`) and nothing is saved: read it again and retry. A mapping has one editable draft and a history of immutable published versions. Editing the draft changes nothing for incoming leads; they keep using the last published version until you publish again. The response is the mapping draft: `id`, `name`, `sourceConnectionId`, `rules`, `revision`, `status` (`ACTIVE` or `ARCHIVED`), `tenantId`, `createdAt` and `updatedAt`.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "mappingId",
            "in": "path",
            "required": true,
            "description": "Field mapping ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMappingDraftRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated mapping draft.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MappingDraft"
                },
                "example": {
                  "id": "e3f4a5b6-c7d8-4e9f-8a0b-1c2d3e4f5a6b",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "name": "IndiaMART enquiry fields",
                  "revision": 4,
                  "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                  "status": "ACTIVE",
                  "rules": [
                    {
                      "sourceField": "SENDER_NAME",
                      "targetField": "lead.fullName",
                      "required": true,
                      "transform": "TRIM"
                    },
                    {
                      "sourceField": "SENDER_MOBILE",
                      "targetField": "identity.phone",
                      "required": true,
                      "transform": "NONE"
                    },
                    {
                      "sourceField": "QUERY_TYPE",
                      "targetField": "attribution.channel",
                      "required": true,
                      "transform": "UPPERCASE"
                    },
                    {
                      "sourceField": "SENDER_STATE",
                      "targetField": "routing.state",
                      "required": false,
                      "transform": "TRIM"
                    }
                  ],
                  "createdAt": "2026-11-20T06:30:00.000Z",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "MAPPING_NOT_FOUND",
            "when": "The field mapping does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/mappings/{mappingId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/mappings": {
      "post": {
        "operationId": "createMapping",
        "summary": "Create a field mapping",
        "description": "Creates the field mapping for a source connection: how the provider's field names translate into lead fields. Each source connection has one mapping; creating a second returns `409`.\n\nEach rule copies one `sourceField` to a `targetField`, optionally trimmed or case-converted. Targets are `lead.*` profile fields, `identity.phone` / `identity.email` / `identity.whatsapp`, `attribution.*` acquisition details, `routing.<name>` values that routing rules can match on, and `attributes.<name>` custom attributes. A record missing a `required` field waits in `NEEDS_MAPPING`. Map a field to `attribution.channel`: records without a channel cannot become leads.\n\nA mapping has one editable draft and a history of immutable published versions. Editing the draft changes nothing for incoming leads; they keep using the last published version until you publish again. The new draft has `revision` 1 and no published version. The response is the mapping draft: `id`, `name`, `sourceConnectionId`, `rules`, `revision`, `status` (`ACTIVE` or `ARCHIVED`), `tenantId`, `createdAt` and `updatedAt`.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMappingDraftRequest"
              },
              "example": {
                "name": "IndiaMART enquiry fields",
                "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                "rules": [
                  {
                    "sourceField": "SENDER_NAME",
                    "targetField": "lead.fullName",
                    "required": true,
                    "transform": "TRIM"
                  },
                  {
                    "sourceField": "SENDER_MOBILE",
                    "targetField": "identity.phone",
                    "required": true,
                    "transform": "NONE"
                  },
                  {
                    "sourceField": "SENDER_EMAIL",
                    "targetField": "identity.email",
                    "required": false,
                    "transform": "LOWERCASE"
                  },
                  {
                    "sourceField": "SENDER_CITY",
                    "targetField": "lead.city",
                    "required": false,
                    "transform": "TRIM"
                  },
                  {
                    "sourceField": "QUERY_PRODUCT_NAME",
                    "targetField": "lead.productInterest",
                    "required": false,
                    "transform": "TRIM"
                  },
                  {
                    "sourceField": "QUERY_TYPE",
                    "targetField": "attribution.channel",
                    "required": true,
                    "transform": "UPPERCASE"
                  },
                  {
                    "sourceField": "SENDER_STATE",
                    "targetField": "routing.state",
                    "required": false,
                    "transform": "TRIM"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new mapping draft.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Location": {
                "description": "URL of the new mapping.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MappingDraft"
                },
                "example": {
                  "id": "e3f4a5b6-c7d8-4e9f-8a0b-1c2d3e4f5a6b",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "name": "IndiaMART enquiry fields",
                  "revision": 1,
                  "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                  "status": "ACTIVE",
                  "rules": [
                    {
                      "sourceField": "SENDER_NAME",
                      "targetField": "lead.fullName",
                      "required": true,
                      "transform": "TRIM"
                    },
                    {
                      "sourceField": "SENDER_MOBILE",
                      "targetField": "identity.phone",
                      "required": true,
                      "transform": "NONE"
                    },
                    {
                      "sourceField": "QUERY_TYPE",
                      "targetField": "attribution.channel",
                      "required": true,
                      "transform": "UPPERCASE"
                    },
                    {
                      "sourceField": "SENDER_STATE",
                      "targetField": "routing.state",
                      "required": false,
                      "transform": "TRIM"
                    }
                  ],
                  "createdAt": "2026-11-20T06:30:00.000Z",
                  "updatedAt": "2026-11-20T06:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/mappings"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/mappings/{mappingId}/publish": {
      "post": {
        "operationId": "publishMapping",
        "summary": "Publish a field mapping",
        "description": "Freezes the current draft as the next numbered version. Records received from now on are mapped with it; records already processed keep the version they were mapped with (replay them to apply the new one). Send the draft's current `revision` as `expectedRevision`. If someone changed the draft since you read it, the request fails with `409` (`STALE_REVISION`) and nothing is saved: read it again and retry. The response is the published version: `id`, `mappingDefinitionId`, `version`, `rules`, `publishedAt`, `publishedBy` and `tenantId`.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "mappingId",
            "in": "path",
            "required": true,
            "description": "Field mapping ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishMappingRequest"
              },
              "example": {
                "expectedRevision": 3
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The published mapping version.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MappingVersion"
                },
                "example": {
                  "id": "c5d6e7f8-a9b0-4c1d-8e2f-3a4b5c6d7e8f",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "mappingDefinitionId": "e3f4a5b6-c7d8-4e9f-8a0b-1c2d3e4f5a6b",
                  "version": 2,
                  "rules": [
                    {
                      "sourceField": "SENDER_NAME",
                      "targetField": "lead.fullName",
                      "required": true,
                      "transform": "TRIM"
                    },
                    {
                      "sourceField": "SENDER_MOBILE",
                      "targetField": "identity.phone",
                      "required": true,
                      "transform": "NONE"
                    },
                    {
                      "sourceField": "QUERY_TYPE",
                      "targetField": "attribution.channel",
                      "required": true,
                      "transform": "UPPERCASE"
                    },
                    {
                      "sourceField": "SENDER_STATE",
                      "targetField": "routing.state",
                      "required": false,
                      "transform": "TRIM"
                    }
                  ],
                  "publishedAt": "2026-12-01T10:15:00.000Z",
                  "publishedBy": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "MAPPING_NOT_FOUND",
            "when": "The field mapping does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/mappings/{mappingId}/publish"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/routing-rulesets/{rulesetId}": {
      "get": {
        "operationId": "getRoutingRuleset",
        "summary": "Get a routing ruleset",
        "description": "Returns the current draft of a source connection's routing ruleset. The response is the routing draft: `id`, `name`, `sourceConnectionId`, `rules`, `revision`, `status` (`ACTIVE` or `ARCHIVED`), `tenantId`, `createdAt` and `updatedAt`. Use `revision` as `expectedRevision` when you update or publish it.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "rulesetId",
            "in": "path",
            "required": true,
            "description": "Ruleset ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The routing draft.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingDraft"
                },
                "example": {
                  "id": "f4a5b6c7-d8e9-4f0a-9b1c-2d3e4f5a6b7c",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "name": "IndiaMART by state",
                  "revision": 2,
                  "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                  "status": "ACTIVE",
                  "rules": [
                    {
                      "id": "a7b8c9d0-e1f2-4a3b-8c4d-5e6f7a8b9c0d",
                      "priority": 100,
                      "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "all": [
                        {
                          "field": "state",
                          "operator": "EQUALS",
                          "value": "Maharashtra"
                        }
                      ]
                    }
                  ],
                  "createdAt": "2026-11-20T06:35:00.000Z",
                  "updatedAt": "2026-12-01T10:05:00.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/routing-rulesets/{rulesetId}"
      },
      "patch": {
        "operationId": "updateRoutingRuleset",
        "summary": "Update a routing ruleset draft",
        "description": "Renames the draft or replaces its whole `rules` list; send at least one of the two. Each save increases `revision`. Send the draft's current `revision` as `expectedRevision`. If someone changed the draft since you read it, the request fails with `409` (`STALE_REVISION`) and nothing is saved: read it again and retry. A routing ruleset has one editable draft and a history of immutable published versions. Editing the draft changes nothing for incoming leads; they keep using the last published version until you publish again. The response is the routing draft: `id`, `name`, `sourceConnectionId`, `rules`, `revision`, `status` (`ACTIVE` or `ARCHIVED`), `tenantId`, `createdAt` and `updatedAt`.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "rulesetId",
            "in": "path",
            "required": true,
            "description": "Ruleset ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRoutingRulesetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated routing draft.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingDraft"
                },
                "example": {
                  "id": "f4a5b6c7-d8e9-4f0a-9b1c-2d3e4f5a6b7c",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "name": "IndiaMART by state",
                  "revision": 3,
                  "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                  "status": "ACTIVE",
                  "rules": [
                    {
                      "id": "a7b8c9d0-e1f2-4a3b-8c4d-5e6f7a8b9c0d",
                      "priority": 100,
                      "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "all": [
                        {
                          "field": "state",
                          "operator": "EQUALS",
                          "value": "Maharashtra"
                        }
                      ]
                    }
                  ],
                  "createdAt": "2026-11-20T06:35:00.000Z",
                  "updatedAt": "2026-12-01T10:05:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/routing-rulesets/{rulesetId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/routing-rulesets": {
      "post": {
        "operationId": "createRoutingRuleset",
        "summary": "Create a routing ruleset",
        "description": "Creates the routing ruleset for a source connection: which campaign each incoming record joins. Each source connection has one routing ruleset; creating a second returns `409`.\n\nA rule matches when all of its conditions hold. Conditions compare the `routing.<name>` values produced by the field mapping: use `<name>` as `field`, with `EQUALS` (one value) or `IN` (a list). The matching rule with the **highest** `priority` wins; if two matching rules share that priority the record waits in `NEEDS_ROUTING`. When nothing matches, the record goes to the connection's `defaultCampaignId`, or waits in `NEEDS_ROUTING` if there is none.\n\nA routing ruleset has one editable draft and a history of immutable published versions. Editing the draft changes nothing for incoming leads; they keep using the last published version until you publish again. The new draft has `revision` 1. The response is the routing draft: `id`, `name`, `sourceConnectionId`, `rules`, `revision`, `status` (`ACTIVE` or `ARCHIVED`), `tenantId`, `createdAt` and `updatedAt`.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRoutingRulesetRequest"
              },
              "example": {
                "name": "IndiaMART by state",
                "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                "rules": [
                  {
                    "id": "a7b8c9d0-e1f2-4a3b-8c4d-5e6f7a8b9c0d",
                    "priority": 100,
                    "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                    "all": [
                      {
                        "field": "state",
                        "operator": "EQUALS",
                        "value": "Maharashtra"
                      }
                    ]
                  },
                  {
                    "id": "b8c9d0e1-f2a3-4b4c-9d5e-6f7a8b9c0d1e",
                    "priority": 50,
                    "campaignId": "3d4e5f6a-7b8c-4d9e-8f0a-2b3c4d5e6f7a",
                    "all": [
                      {
                        "field": "state",
                        "operator": "IN",
                        "value": [
                          "Gujarat",
                          "Goa"
                        ]
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new routing draft.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Location": {
                "description": "URL of the new routing ruleset.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingDraft"
                },
                "example": {
                  "id": "f4a5b6c7-d8e9-4f0a-9b1c-2d3e4f5a6b7c",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "name": "IndiaMART by state",
                  "revision": 1,
                  "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                  "status": "ACTIVE",
                  "rules": [
                    {
                      "id": "a7b8c9d0-e1f2-4a3b-8c4d-5e6f7a8b9c0d",
                      "priority": 100,
                      "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "all": [
                        {
                          "field": "state",
                          "operator": "EQUALS",
                          "value": "Maharashtra"
                        }
                      ]
                    }
                  ],
                  "createdAt": "2026-11-20T06:35:00.000Z",
                  "updatedAt": "2026-11-20T06:35:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/routing-rulesets"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/routing-rulesets/{rulesetId}/publish": {
      "post": {
        "operationId": "publishRoutingRuleset",
        "summary": "Publish a routing ruleset",
        "description": "Freezes the current draft, together with the connection's current default campaign, as the next numbered version; records received from now on are routed with it. Every target campaign must be active, in an active process and enabled for lead management, otherwise the request fails with `409` (`CAMPAIGN_INELIGIBLE`). Send the draft's current `revision` as `expectedRevision`. If someone changed the draft since you read it, the request fails with `409` (`STALE_REVISION`) and nothing is saved: read it again and retry. The response is the published version: `id`, `routingRulesetId`, `version`, `rules`, `defaultCampaignId`, `publishedAt`, `publishedBy` and `tenantId`.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "rulesetId",
            "in": "path",
            "required": true,
            "description": "Ruleset ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishRoutingRulesetRequest"
              },
              "example": {
                "expectedRevision": 2
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The published routing version.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingVersion"
                },
                "example": {
                  "id": "d6e7f8a9-b0c1-4d2e-9f3a-4b5c6d7e8f90",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "routingRulesetId": "f4a5b6c7-d8e9-4f0a-9b1c-2d3e4f5a6b7c",
                  "version": 2,
                  "rules": [
                    {
                      "id": "a7b8c9d0-e1f2-4a3b-8c4d-5e6f7a8b9c0d",
                      "priority": 100,
                      "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "all": [
                        {
                          "field": "state",
                          "operator": "EQUALS",
                          "value": "Maharashtra"
                        }
                      ]
                    }
                  ],
                  "defaultCampaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "publishedAt": "2026-12-01T10:20:00.000Z",
                  "publishedBy": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/routing-rulesets/{rulesetId}/publish"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/source-records": {
      "get": {
        "operationId": "listActionableSourceRecords",
        "summary": "List records that need attention",
        "description": "Lists source records stuck in one `processingState` (`NEEDS_MAPPING`, `NEEDS_ROUTING`, `INVALID` or `PROCESSING_FAILED`), optionally for one source connection. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`. Each item has `id`, `providerRecordId`, `sourceConnectionId`, `processingState`, `currentRevisionSequence`, `firstReceivedAt`, `lastReceivedAt`, `providerSubmittedAt`, `createdAt` and `updatedAt`. Fix the mapping or routing and **Replay** the record, or **Route** it by hand.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "processingState",
            "in": "query",
            "required": true,
            "description": "Which stopped records to list: `NEEDS_MAPPING`, `NEEDS_ROUTING`, `INVALID` or `PROCESSING_FAILED`.",
            "schema": {
              "type": "string",
              "enum": [
                "NEEDS_MAPPING",
                "NEEDS_ROUTING",
                "INVALID",
                "PROCESSING_FAILED"
              ]
            }
          },
          {
            "name": "sourceConnectionId",
            "in": "query",
            "required": false,
            "description": "Only records from this source.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of records: `items` and `nextCursor`.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceRecordPage"
                },
                "example": {
                  "items": [
                    {
                      "id": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",
                      "providerRecordId": "IM-2611-48213",
                      "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                      "processingState": "NEEDS_ROUTING",
                      "currentRevisionSequence": 1,
                      "firstReceivedAt": "2026-11-28T09:14:52.000Z",
                      "lastReceivedAt": "2026-11-28T09:14:52.000Z",
                      "providerSubmittedAt": "2026-11-28T09:14:40.000Z",
                      "createdAt": "2026-11-28T09:14:52.000Z",
                      "updatedAt": "2026-11-28T09:14:53.000Z"
                    }
                  ],
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/source-records"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/source-records/{sourceRecordId}": {
      "get": {
        "operationId": "getSourceRecord",
        "summary": "Get a source record",
        "description": "Returns one record as received from the provider, with its revisions (the extracted fields of each delivery), every routing decision, every replay attempt, the delivery it arrived in, and the lead it produced, if any.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "sourceRecordId",
            "in": "path",
            "required": true,
            "description": "Source record ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The source record.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceRecordDetailResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "SOURCE_RECORD_NOT_FOUND",
            "when": "The source record does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/source-records/{sourceRecordId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/source-records/{sourceRecordId}/replay": {
      "post": {
        "operationId": "replaySourceRecord",
        "summary": "Replay a source record",
        "description": "Processes a record again. `versionSelection: CURRENT` uses the latest published mapping and routing (typical after a fix); `ORIGINAL` uses the versions it was first processed with. `revisionId` picks a specific delivery of the record; by default the latest is used. `reason` is an upper-case code you choose (for example `MAPPING_FIXED`) that is stored with the decision. The response reports what happened: `MATERIALIZED` (a lead was created and `lead.created` is published), `DUPLICATE` (the record already produced a lead), or `NEEDS_MAPPING` / `NEEDS_ROUTING` with a `reasonCode` when it still cannot be processed.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "sourceRecordId",
            "in": "path",
            "required": true,
            "description": "Source record ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaySourceRecordBody"
              },
              "example": {
                "reason": "MAPPING_FIXED",
                "versionSelection": "CURRENT"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What happened to the record.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplaySourceRecordResponse"
                },
                "example": {
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "reasonCode": null,
                  "sourceRecordId": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",
                  "sourceRecordRevisionId": "f6a7b8c9-d0e1-4f2a-9b3c-4d5e6f7a8b9c",
                  "status": "MATERIALIZED",
                  "validationIssues": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "SOURCE_RECORD_NOT_FOUND",
            "when": "The source record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/source-records/{sourceRecordId}/replay"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/source-records/{sourceRecordId}/route": {
      "post": {
        "operationId": "routeSourceRecord",
        "summary": "Route a source record by hand",
        "description": "Sends a record, typically one waiting in `NEEDS_ROUTING`, to the campaign you choose, using the published mapping it was received with. The decision is recorded as manual. `reason` is an upper-case code you choose (for example `MAPPING_FIXED`) that is stored with the decision. The response reports what happened: `MATERIALIZED` (a lead was created and `lead.created` is published), `DUPLICATE` (the record already produced a lead), or `NEEDS_MAPPING` / `NEEDS_ROUTING` with a `reasonCode` when it still cannot be processed.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "sourceRecordId",
            "in": "path",
            "required": true,
            "description": "Source record ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManualRouteSourceRecordRequest"
              },
              "example": {
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "reason": "MANUAL_ROUTE"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What happened to the record.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplaySourceRecordResponse"
                },
                "example": {
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "reasonCode": null,
                  "sourceRecordId": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",
                  "sourceRecordRevisionId": "f6a7b8c9-d0e1-4f2a-9b3c-4d5e6f7a8b9c",
                  "status": "MATERIALIZED",
                  "validationIssues": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "SOURCE_RECORD_NOT_FOUND",
            "when": "The source record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/source-records/{sourceRecordId}/route"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/batches": {
      "get": {
        "operationId": "listIngestionBatches",
        "summary": "List delivery batches",
        "description": "Lists delivery batches, newest first: webhook deliveries, poll runs and file imports, with counts of records received, accepted, duplicated, rejected and waiting for mapping or routing. Filter by `sourceConnectionId` or a single `batchId`. At most 50 batches are returned.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "batchId",
            "in": "query",
            "required": false,
            "description": "ID of the batch.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "sourceConnectionId",
            "in": "query",
            "required": false,
            "description": "ID of the source connection.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recent batches.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/IngestionBatchResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/batches"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/batches/{batchId}": {
      "get": {
        "operationId": "getIngestionBatch",
        "summary": "Get a delivery batch",
        "description": "Returns one batch with the same counters as **List delivery batches**, plus `attempts` (each processing attempt with `attemptNumber`, `outcome`, `failureCode`, `safeErrorSummary`, `durationMs` and `completedAt`, newest first) and `sourceRecordIds` (up to 50 records that arrived in it).\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "description": "Batch ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The batch with its attempts and records.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestionBatchDetail"
                },
                "example": {
                  "fileName": null,
                  "acceptedCount": 11,
                  "attemptCount": 1,
                  "batchId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
                  "completedAt": "2026-11-28T09:15:04.000Z",
                  "duplicateCount": 0,
                  "failedCount": 0,
                  "intakeMode": "WEBHOOK",
                  "lastFailureCode": null,
                  "lastFailureSummary": null,
                  "needsMappingCount": 0,
                  "needsRoutingCount": 1,
                  "receivedCount": 12,
                  "rejectedCount": 0,
                  "sourceConnectionId": "7a8b9c0d-1e2f-4a3b-9c4d-5e6f7a8b9c0d",
                  "sourceConnectionName": "IndiaMART · Pune",
                  "startedAt": "2026-11-28T09:14:52.000Z",
                  "status": "COMPLETED",
                  "attempts": [
                    {
                      "attemptNumber": 1,
                      "outcome": "COMPLETED",
                      "failureCode": null,
                      "safeErrorSummary": null,
                      "durationMs": 1200,
                      "completedAt": "2026-11-28T09:15:04.000Z"
                    }
                  ],
                  "sourceRecordIds": [
                    "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "BATCH_NOT_FOUND",
            "when": "The batch does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/batches/{batchId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/exceptions": {
      "get": {
        "operationId": "listIntakeExceptions",
        "summary": "List intake exceptions",
        "description": "Lists everything that went wrong on the way in, newest first: records waiting for mapping or routing, permanently rejected deliveries and deliveries that need reconciliation. `category=retryable` returns what a replay can fix; `category=correction` returns what needs a change at the source. Filter by source connection, batch or source record. At most 50 per page: when there are more, the response carries an `X-Next-Cursor` header; pass it back as `cursor`.\n\n**Scope:** `intake.read` (read intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "batchId",
            "in": "query",
            "required": false,
            "description": "ID of the batch.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "sourceConnectionId",
            "in": "query",
            "required": false,
            "description": "ID of the source connection.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sourceRecordId",
            "in": "query",
            "required": false,
            "description": "ID of the source record.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Category, from the values below.",
            "schema": {
              "type": "string",
              "enum": [
                "retryable",
                "correction"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "maxLength": 256,
              "format": "base64url",
              "contentEncoding": "base64url",
              "pattern": "^[A-Za-z0-9_-]*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of exceptions.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-Next-Cursor": {
                "description": "Cursor for the next page. Absent on the last page.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadExceptionResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/exceptions"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/imports/preview": {
      "post": {
        "operationId": "previewLeadImport",
        "summary": "Preview a spreadsheet import",
        "description": "Reads a CSV or Excel (`.xlsx`) file and shows what importing it into a campaign would do, without saving anything. Send the file as base64 in `file.content` (up to 2 MB and 500 rows; larger bodies return `413`).\n\nColumns are matched to lead fields automatically; override the match with `mapping`, from a field key (`fullName`, `companyName`, `phone`, `email`, `productInterest`, `inquirySummary`, `city`, `state`, `country` or a customer-form field) to a zero-based column index. For workbooks, `sheetName` picks the sheet.\n\nThe response lists each row with its errors and whether it duplicates an existing lead, plus a `reviewToken` to pass to **Import a spreadsheet**. The campaign must be active and enabled for lead management (`409` otherwise).\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadImportPreviewRequest"
              },
              "example": {
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "file": {
                  "fileName": "pune-rooftop-leads.csv",
                  "content": "bmFtZSxwaG9uZSxwcm9kdWN0CkFzaGEgVmVybWEsKzkxOTgxMjM0NTY3OCxSb29mdG9wIHNvbGFyIDUga1cKUm9oaXQgS3Vsa2FybmksKzkxOTgyMzQ1Njc4OSxSb29mdG9wIHNvbGFyIDMga1cK"
                },
                "mapping": {
                  "fullName": 0,
                  "phone": 1,
                  "productInterest": 2
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What the import would do.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadImportPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 413,
            "code": "REQUEST_BODY_TOO_LARGE",
            "when": "The upload is too large."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/imports/preview"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/imports": {
      "post": {
        "operationId": "importLeads",
        "summary": "Import a spreadsheet",
        "description": "Creates leads from a previewed file. Send the same `file`, `campaignId`, `sheetName` and `mapping` you previewed, plus the preview's `reviewToken`. All rows are imported in one transaction: if any row is invalid, nothing is imported.\n\n- If the file or the campaign's customer form changed since the preview, the request fails with `409` (`IMPORT_REVIEW_CHANGED`): preview again.\n- Rows that match an existing lead are recorded on it as repeat enquiries (`lead.repeat_enquiry`) instead of creating a lead; new leads publish `lead.created`.\n- Sending the same request again is safe: it returns the original batch with `alreadyImported: true`.\n\n**Scope:** `intake.write` (change intake setup).",
        "tags": [
          "Lead intake"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadImportCommitRequest"
              },
              "example": {
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "file": {
                  "fileName": "pune-rooftop-leads.csv",
                  "content": "bmFtZSxwaG9uZSxwcm9kdWN0CkFzaGEgVmVybWEsKzkxOTgxMjM0NTY3OCxSb29mdG9wIHNvbGFyIDUga1cKUm9oaXQgS3Vsa2FybmksKzkxOTgyMzQ1Njc4OSxSb29mdG9wIHNvbGFyIDMga1cK"
                },
                "mapping": {
                  "fullName": 0,
                  "phone": 1,
                  "productInterest": 2
                },
                "reviewToken": "9f2c4e6a8b0d1f3e5a7c9b1d3f5e7a9c0b2d4f6e8a0c2e4f6a8b0d2f4e6a8c0b"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The import result.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadImportResult"
                },
                "example": {
                  "batchId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
                  "fileName": "pune-rooftop-leads.csv",
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "createdCount": 2,
                  "duplicateCount": 0,
                  "alreadyImported": false,
                  "leads": [
                    {
                      "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                      "rowNumber": 2,
                      "fullName": "Asha Verma",
                      "companyName": ""
                    },
                    {
                      "leadId": "1c7d8b63-5a1f-4d2b-8e54-4a3b8d2f0c21",
                      "rowNumber": 3,
                      "fullName": "Rohit Kulkarni",
                      "companyName": ""
                    }
                  ],
                  "repeatEnquiryCount": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "intake.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "intake.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `intake.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 413,
            "code": "REQUEST_BODY_TOO_LARGE",
            "when": "The upload is too large."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/imports"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/stages": {
      "get": {
        "operationId": "listStages",
        "summary": "List pipeline stages",
        "description": "Lists the pipeline stages of a process in display order, including inactive ones. Each stage maps to a fixed `semanticCategory` (`NEW`, `OPEN`, `CONTACTED`, `QUALIFIED`, `CONVERTED`, `LOST`, `DISQUALIFIED`) that reports and events use, so stage names can differ between processes.\n\n**Scope:** `ownership.read` (read ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "processId",
            "in": "query",
            "required": true,
            "description": "ID of the process.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The process's stages.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/StageResponse"
                  }
                },
                "example": [
                  {
                    "createdAt": "2026-11-28T09:15:00.000Z",
                    "displayOrder": 3,
                    "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                    "isActive": true,
                    "isInitial": false,
                    "name": "Site survey booked",
                    "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                    "semanticCategory": "QUALIFIED",
                    "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/stages"
      },
      "post": {
        "operationId": "createStage",
        "summary": "Create a pipeline stage",
        "description": "Adds a stage to a process. A process has exactly one active initial stage, where new leads start. Stage names are unique among a process's active stages (`409 STAGE_NAME_CONFLICT`).\n\n- An ordinary stage: leave `isInitial` out (as in the example).\n- A new initial stage in place of the current one: send `isInitial: true` and `replaceInitial: true`. With `isInitial` alone the request fails with `409 INITIAL_STAGE_CONFLICT`.\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStageRequest"
              },
              "example": {
                "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                "name": "Site survey booked",
                "semanticCategory": "QUALIFIED",
                "displayOrder": 3
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new stage.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StageResponse"
                },
                "example": {
                  "createdAt": "2026-11-28T09:15:00.000Z",
                  "displayOrder": 3,
                  "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                  "isActive": true,
                  "isInitial": false,
                  "name": "Site survey booked",
                  "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                  "semanticCategory": "QUALIFIED",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STAGE_NAME_CONFLICT",
            "when": "Another stage already has this name."
          },
          {
            "status": 409,
            "code": "INITIAL_STAGE_CONFLICT",
            "when": "The process already has an initial stage; clear it or send `replaceInitial`."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/stages"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/stages/{stageId}": {
      "patch": {
        "operationId": "updateStage",
        "summary": "Update a pipeline stage",
        "description": "Renames, reorders, recategorises, activates or deactivates a stage. Send only the fields to change. To move the initial flag to this stage, send `isInitial: true` with `replaceInitial: true` (it must also be active); the previous initial stage loses the flag in the same change.\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "stageId",
            "in": "path",
            "required": true,
            "description": "Stage ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateStageRequest"
              },
              "example": {
                "name": "Survey scheduled",
                "displayOrder": 4
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated stage.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "STAGE_NOT_FOUND",
            "when": "The stage does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STAGE_NAME_CONFLICT",
            "when": "Another stage already has this name."
          },
          {
            "status": 409,
            "code": "INITIAL_STAGE_CONFLICT",
            "when": "The process already has an initial stage; clear it or send `replaceInitial`."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/stages/{stageId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/segments": {
      "get": {
        "operationId": "listSegments",
        "summary": "List segments",
        "description": "Lists all segments, active and archived, in display order, optionally for one process. Segments label what kind of lead something is (for example *High-value residential*); segmentation rules assign them. For large workspaces use **List segments (paged)**.\n\n**Scope:** `ownership.read` (read ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "processId",
            "in": "query",
            "required": false,
            "description": "ID of the process.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "All matching segments.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadSegmentResponse"
                  }
                },
                "example": [
                  {
                    "colorToken": "AMBER",
                    "createdAt": "2026-11-28T09:15:00.000Z",
                    "description": "Homes with a monthly bill above ₹5,000.",
                    "displayOrder": 1,
                    "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e",
                    "name": "High-value residential",
                    "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                    "status": "ACTIVE",
                    "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/segments"
      },
      "post": {
        "operationId": "createSegment",
        "summary": "Create a segment",
        "description": "Adds a segment to a process. `colorToken` defaults to `SLATE` and `displayOrder` to 0. Segment names are unique among a process's active segments (`409`). The segment is not used until a published segmentation ruleset refers to it or someone sets it on a lead.\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSegmentRequest"
              },
              "example": {
                "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                "name": "High-value residential",
                "description": "Homes with a monthly bill above ₹5,000.",
                "colorToken": "AMBER",
                "displayOrder": 1
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new segment.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSegmentResponse"
                },
                "example": {
                  "colorToken": "AMBER",
                  "createdAt": "2026-11-28T09:15:00.000Z",
                  "description": "Homes with a monthly bill above ₹5,000.",
                  "displayOrder": 1,
                  "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e",
                  "name": "High-value residential",
                  "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                  "status": "ACTIVE",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 409,
            "code": "SEGMENT_NAME_CONFLICT",
            "when": "Another segment already has this name."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/segments"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/segments/page": {
      "get": {
        "operationId": "listSegmentsPage",
        "summary": "List segments (paged)",
        "description": "Lists segments in display order, filtered by process and `status` (`ACTIVE` or `ARCHIVED`). Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `ownership.read` (read ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "processId",
            "in": "query",
            "required": false,
            "description": "ID of the process.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the segment.",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of segments.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSegmentPageResponse"
                },
                "example": {
                  "items": [
                    {
                      "colorToken": "AMBER",
                      "createdAt": "2026-11-28T09:15:00.000Z",
                      "description": "Homes with a monthly bill above ₹5,000.",
                      "displayOrder": 1,
                      "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e",
                      "name": "High-value residential",
                      "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "status": "ACTIVE",
                      "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                      "updatedAt": "2026-12-01T10:00:00.000Z"
                    }
                  ],
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/segments/page"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/segments/lookup": {
      "get": {
        "operationId": "lookupSegments",
        "summary": "Look up segments by ID",
        "description": "Returns the segments with the given IDs, active or archived, so you can label leads that reference them. Repeat the `segmentId` query parameter for each ID (`?segmentId=…&segmentId=…`, 1 to 100 IDs); duplicates are ignored and unknown IDs are left out. For long lists use the `QUERY` form of this operation.\n\n**Scope:** `ownership.read` (read ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "The segments found.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadSegmentResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/segments/lookup"
      },
      "x-query": {
        "operationId": "querySegmentLookup",
        "summary": "Look up segments by ID (query)",
        "description": "Same as **Look up segments by ID**, with the IDs sent as `segmentIds` in a JSON body using the HTTP `QUERY` method (safe and idempotent, like `GET`). Send `Content-Type: application/json`.\n\n**Scope:** `ownership.read` (read ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadSegmentLookupQuery"
              },
              "example": {
                "segmentIds": [
                  "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e",
                  "6b7c8d9e-0f1a-4b2c-9d3e-4f5a6b7c8d9f"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The segments found.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LeadSegmentResponse"
                  }
                },
                "example": [
                  {
                    "colorToken": "AMBER",
                    "createdAt": "2026-11-28T09:15:00.000Z",
                    "description": "Homes with a monthly bill above ₹5,000.",
                    "displayOrder": 1,
                    "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e",
                    "name": "High-value residential",
                    "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                    "status": "ACTIVE",
                    "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableContent"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 415,
            "code": "QUERY_CONTENT_TYPE_UNSUPPORTED",
            "when": "The `QUERY` request has no `Content-Type: application/json` body."
          },
          {
            "status": 422,
            "code": "QUERY_VALIDATION_FAILED",
            "when": "The `QUERY` body is JSON but does not match the request fields."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "QUERY /lms/segments/lookup"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/segments/{segmentId}": {
      "patch": {
        "operationId": "updateSegment",
        "summary": "Update a segment",
        "description": "Changes a segment's name, description, colour or display order. Send only the fields to change. Archived segments cannot be changed (`409`).\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "segmentId",
            "in": "path",
            "required": true,
            "description": "Segment ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSegmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated segment.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSegmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "SEGMENT_NOT_FOUND",
            "when": "The segment does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "SEGMENT_NAME_CONFLICT",
            "when": "Another segment already has this name."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/segments/{segmentId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/segments/{segmentId}/archive": {
      "post": {
        "operationId": "archiveSegment",
        "summary": "Archive a segment",
        "description": "Archives a segment so it can no longer be chosen. Leads already in it keep it. A segment that the current published segmentation version still uses cannot be archived: the request fails with `409` (`SEGMENT_IN_USE`) and lists the rulesets in `details.rulesetIds`. Archiving an archived segment returns it unchanged. No request body.\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "segmentId",
            "in": "path",
            "required": true,
            "description": "Segment ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The archived segment.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadSegmentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "SEGMENT_NOT_FOUND",
            "when": "The segment does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/segments/{segmentId}/archive"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/segmentation-rulesets": {
      "get": {
        "operationId": "listSegmentationRulesets",
        "summary": "List segmentation rulesets",
        "description": "Lists segmentation rulesets with their drafts, filtered by process and `status`. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `ownership.read` (read ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "processId",
            "in": "query",
            "required": false,
            "description": "ID of the process.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the segmentation ruleset.",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of segmentation rulesets.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SegmentationRulesetPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/segmentation-rulesets"
      },
      "post": {
        "operationId": "createSegmentationRuleset",
        "summary": "Create a segmentation ruleset",
        "description": "Creates an empty segmentation ruleset for a process, at `revision` 0 with no published version. Each process has at most one active segmentation ruleset. It is an editable draft plus immutable published versions; leads evaluated after publication (new leads and **Re-run ownership rules**) use the latest published version, so editing the draft has no effect until you publish. A process that already has an active segmentation ruleset returns `409` (`SEGMENTATION_RULESET_EXISTS`).\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSegmentationRulesetRequest"
              },
              "example": {
                "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                "name": "Solar enquiries"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new, empty ruleset.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SegmentationRulesetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/segmentation-rulesets"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/segmentation-rulesets/{rulesetId}": {
      "get": {
        "operationId": "getSegmentationRuleset",
        "summary": "Get a segmentation ruleset",
        "description": "Returns the ruleset's draft (`rules`, `defaultSegmentId`, `revision`) and, in `currentVersionData`, the version currently in force (`null` until the first publish). Use `revision` as `expectedRevision` when you update or publish it.\n\n**Scope:** `ownership.read` (read ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "rulesetId",
            "in": "path",
            "required": true,
            "description": "Ruleset ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The segmentation ruleset.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SegmentationRulesetDetailResponse"
                },
                "example": {
                  "createdAt": "2026-11-28T09:15:00.000Z",
                  "currentVersion": 1,
                  "currentVersionId": "f7a8b9c0-d1e2-4f3a-8b4c-5d6e7f8a9b0c",
                  "currentVersionData": {
                    "defaultSegmentId": "6b7c8d9e-0f1a-4b2c-9d3e-4f5a6b7c8d9f",
                    "id": "f7a8b9c0-d1e2-4f3a-8b4c-5d6e7f8a9b0c",
                    "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                    "publishedAt": "2026-12-01T10:00:00.000Z",
                    "publishedBy": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                    "rules": [
                      {
                        "id": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
                        "priority": 10,
                        "segmentId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e",
                        "all": [
                          {
                            "field": "lead.productInterest",
                            "operator": "CONTAINS",
                            "value": "solar"
                          },
                          {
                            "field": "attributes.monthlyBill",
                            "operator": "GREATER_THAN_OR_EQUAL",
                            "value": 5000
                          }
                        ]
                      }
                    ],
                    "rulesetId": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
                    "version": 1
                  },
                  "defaultSegmentId": "6b7c8d9e-0f1a-4b2c-9d3e-4f5a6b7c8d9f",
                  "id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
                  "name": "Solar enquiries",
                  "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                  "revision": 1,
                  "rules": [
                    {
                      "id": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
                      "priority": 10,
                      "segmentId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e",
                      "all": [
                        {
                          "field": "lead.productInterest",
                          "operator": "CONTAINS",
                          "value": "solar"
                        },
                        {
                          "field": "attributes.monthlyBill",
                          "operator": "GREATER_THAN_OR_EQUAL",
                          "value": 5000
                        }
                      ]
                    }
                  ],
                  "status": "ACTIVE",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/segmentation-rulesets/{rulesetId}"
      },
      "patch": {
        "operationId": "updateSegmentationRuleset",
        "summary": "Save a segmentation ruleset draft",
        "description": "Replaces the whole draft: `name`, `rules` and `defaultSegmentId` are all required.\n\nRules are tried in ascending `priority` (lowest number first) and the first rule whose conditions all match sets the segment; leads that match nothing get `defaultSegmentId` (or no segment when it is `null`). Priorities and rule IDs must be unique; a rule with an empty `all` list matches every lead. Conditions compare lead fields (`lead.*`, `acquisition.*`, `campaign.id`) or custom attributes (`attributes.<name>`). Every referenced segment must be active and belong to the ruleset's process (`409` otherwise).\n\nSend `contractVersion: 2` to compare `lead.priority` by rank (1 = low to 4 = urgent).\n\nSend the draft's current `revision` as `expectedRevision`. If someone changed the draft since you read it, the request fails with `409` (`STALE_REVISION`) and nothing is saved: read it again and retry. Archived rulesets cannot be changed (`409`).\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "rulesetId",
            "in": "path",
            "required": true,
            "description": "Ruleset ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSegmentationRulesetWireRequest"
              },
              "example": {
                "expectedRevision": 0,
                "name": "Solar enquiries",
                "defaultSegmentId": "6b7c8d9e-0f1a-4b2c-9d3e-4f5a6b7c8d9f",
                "rules": [
                  {
                    "id": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
                    "priority": 10,
                    "segmentId": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e",
                    "all": [
                      {
                        "field": "lead.productInterest",
                        "operator": "CONTAINS",
                        "value": "solar"
                      },
                      {
                        "field": "attributes.monthlyBill",
                        "operator": "GREATER_THAN_OR_EQUAL",
                        "value": 5000
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved draft.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SegmentationRulesetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/segmentation-rulesets/{rulesetId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/segmentation-rulesets/{rulesetId}/publish": {
      "post": {
        "operationId": "publishSegmentationRuleset",
        "summary": "Publish a segmentation ruleset",
        "description": "Freezes the current draft as the next numbered version, which is then used for every lead segmented from now on. Existing leads keep their segment until they are re-evaluated. The referenced segments are checked again (`409` if any is no longer active). Send the draft's current `revision` as `expectedRevision`. If someone changed the draft since you read it, the request fails with `409` (`STALE_REVISION`) and nothing is saved: read it again and retry.\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "rulesetId",
            "in": "path",
            "required": true,
            "description": "Ruleset ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishRulesetRequest"
              },
              "example": {
                "expectedRevision": 1
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The published version.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SegmentationVersionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/segmentation-rulesets/{rulesetId}/publish"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/allocation-rulesets": {
      "get": {
        "operationId": "listAllocationRulesets",
        "summary": "List allocation rulesets",
        "description": "Lists allocation rulesets with their drafts, filtered by process and `status`. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `ownership.read` (read ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "processId",
            "in": "query",
            "required": false,
            "description": "ID of the process.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the allocation ruleset.",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of allocation rulesets.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllocationRulesetPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/allocation-rulesets"
      },
      "post": {
        "operationId": "createAllocationRuleset",
        "summary": "Create an allocation ruleset",
        "description": "Creates an empty allocation ruleset for a process, at `revision` 0 with no published version. Each process has at most one active allocation ruleset. It is an editable draft plus immutable published versions; leads evaluated after publication (new leads and **Re-run ownership rules**) use the latest published version, so editing the draft has no effect until you publish. A process that already has an active allocation ruleset returns `409` (`ALLOCATION_RULESET_EXISTS`).\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAllocationRulesetRequest"
              },
              "example": {
                "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                "name": "Solar allocation"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new, empty ruleset.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllocationRulesetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/allocation-rulesets"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/allocation-rulesets/{rulesetId}": {
      "get": {
        "operationId": "getAllocationRuleset",
        "summary": "Get an allocation ruleset",
        "description": "Returns the ruleset's draft (`rules`, `fallbackTeamId`, `revision`) and, in `currentVersionData`, the version currently in force (`null` until the first publish). Use `revision` as `expectedRevision` when you update or publish it.\n\n**Scope:** `ownership.read` (read ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "rulesetId",
            "in": "path",
            "required": true,
            "description": "Ruleset ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The allocation ruleset.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllocationRulesetDetailResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/allocation-rulesets/{rulesetId}"
      },
      "patch": {
        "operationId": "updateAllocationRuleset",
        "summary": "Save an allocation ruleset draft",
        "description": "Replaces the whole draft: `name`, `rules` and `fallbackTeamId` are all required.\n\nRules are tried in ascending `priority` (lowest number first) and the first rule whose conditions all match decides the owner:\n\n- `FIXED_AGENT` assigns `userId` in `teamId` (a `userId` is required).\n- `TEAM_QUEUE` puts the lead in the team's queue (`userId` must be `null`).\n- `ROUND_ROBIN` rotates through the team's members (`userId` must be `null`).\n\nLeads that match nothing go to the `fallbackTeamId` queue, or stay unassigned when it is `null`. Conditions compare `segment.id`, `campaign.id`, `source.connectionId`, `source.definitionKey`, lead fields or custom attributes (`attributes.<name>`). Referenced teams and members must be active (`409` otherwise). Leads with a manual assignment lock are never reassigned by rules.\n\nSend the draft's current `revision` as `expectedRevision`. If someone changed the draft since you read it, the request fails with `409` (`STALE_REVISION`) and nothing is saved: read it again and retry. Archived rulesets cannot be changed (`409`).\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "rulesetId",
            "in": "path",
            "required": true,
            "description": "Ruleset ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAllocationRulesetRequest"
              },
              "example": {
                "expectedRevision": 0,
                "name": "Solar allocation",
                "fallbackTeamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                "rules": [
                  {
                    "id": "d4e5f6a7-b8c9-4d0e-9f1a-2b3c4d5e6f7a",
                    "priority": 10,
                    "strategy": "FIXED_AGENT",
                    "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                    "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                    "all": [
                      {
                        "field": "segment.id",
                        "operator": "EQUALS",
                        "value": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e"
                      }
                    ]
                  },
                  {
                    "id": "e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a8b",
                    "priority": 20,
                    "strategy": "ROUND_ROBIN",
                    "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                    "userId": null,
                    "all": [
                      {
                        "field": "lead.city",
                        "operator": "IN",
                        "value": [
                          "Pune",
                          "Pimpri-Chinchwad"
                        ]
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved draft.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllocationRulesetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /lms/allocation-rulesets/{rulesetId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/allocation-rulesets/{rulesetId}/publish": {
      "post": {
        "operationId": "publishAllocationRuleset",
        "summary": "Publish an allocation ruleset",
        "description": "Freezes the current draft as the next numbered version, which is then used for every lead allocated from now on. Existing leads keep their owner until they are re-evaluated. Referenced teams and members are checked again (`409` if any is no longer eligible). Send the draft's current `revision` as `expectedRevision`. If someone changed the draft since you read it, the request fails with `409` (`STALE_REVISION`) and nothing is saved: read it again and retry.\n\n**Scope:** `ownership.write` (change ownership rules).",
        "tags": [
          "Ownership"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "rulesetId",
            "in": "path",
            "required": true,
            "description": "Ruleset ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishRulesetRequest"
              },
              "example": {
                "expectedRevision": 1
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The published version.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllocationVersionResponse"
                },
                "example": {
                  "fallbackTeamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "id": "a8b9c0d1-e2f3-4a4b-9c5d-6e7f8a9b0c1d",
                  "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                  "publishedAt": "2026-12-01T10:00:00.000Z",
                  "publishedBy": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                  "rules": [
                    {
                      "id": "d4e5f6a7-b8c9-4d0e-9f1a-2b3c4d5e6f7a",
                      "priority": 10,
                      "strategy": "FIXED_AGENT",
                      "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "all": [
                        {
                          "field": "segment.id",
                          "operator": "EQUALS",
                          "value": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8e"
                        }
                      ]
                    },
                    {
                      "id": "e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a8b",
                      "priority": 20,
                      "strategy": "ROUND_ROBIN",
                      "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                      "userId": null,
                      "all": [
                        {
                          "field": "lead.city",
                          "operator": "IN",
                          "value": [
                            "Pune",
                            "Pimpri-Chinchwad"
                          ]
                        }
                      ]
                    }
                  ],
                  "rulesetId": "9c0d1e2f-3a4b-4c5d-9e6f-7a8b9c0d1e2f",
                  "version": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "ownership.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "ownership.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `ownership.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/allocation-rulesets/{rulesetId}/publish"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/calling/agent": {
      "get": {
        "operationId": "getMyCallingStatus",
        "summary": "Get my calling status",
        "description": "Returns the calling state of the acting member: the campaigns they are assigned to, their calling session (ready, paused, on a call or in wrap-up, with any break reason), whether they can take calls right now and why not, and the call in progress, if any. It acts as the API key's acting member, so it returns that member's own data, as an agent would see it in the calling workspace.\n\nDesigned for the agent workspace. Poll it to mirror an agent's state; it never changes anything.\n\nWhat to do next, by `session.state`:\n- `READY` or `PAUSED`: no call is live (`currentCall` is `null`); `available` and `reason` say whether calls can arrive.\n- `ON_CALL`: read the live call from `currentCall` or with [Get a call](#getCall); end it with [Hang up a call](#hangUpCall).\n- `WRAP_UP`: the call has ended; record the result with [Save a call's outcome](#saveCallOutcome).\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "The acting member's calling status.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanAgentStatus"
                },
                "example": {
                  "campaigns": [
                    {
                      "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "campaignName": "Pune rooftop launch",
                      "running": true
                    }
                  ],
                  "assignment": {
                    "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                    "campaignName": "Pune rooftop launch",
                    "mode": "PROGRESSIVE",
                    "running": true
                  },
                  "session": {
                    "id": "a4b5c6d7-e8f9-4a0b-9c1d-2e3f4a5b6c7d",
                    "state": "READY",
                    "availability": "READY",
                    "mode": "PROGRESSIVE",
                    "strategy": "PAIRED",
                    "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                    "nextCallAt": "2026-12-01T10:02:30.000Z",
                    "expiresAt": "2026-12-01T10:05:00.000Z",
                    "intervalSeconds": 30,
                    "revision": 7,
                    "pauseReason": null,
                    "breakReasonKey": null,
                    "breakReasonLabel": null
                  },
                  "available": true,
                  "deviceType": "BROWSER",
                  "browserSessionId": "b5c6d7e8-f9a0-4b1c-8d2e-3f4a5b6c7d8e",
                  "browserRegistered": true,
                  "reason": null,
                  "endpointLabel": "Browser phone",
                  "streamHealthy": true,
                  "currentCall": null,
                  "controlCall": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/calling/agent"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/calling/daily-stats": {
      "get": {
        "operationId": "getMyDailyCallStats",
        "summary": "Get my call statistics for today",
        "description": "Counts the acting member's calls since midnight today: customers dialed, conversations connected, calls with a saved outcome, and total talk time in seconds. \"Today\" follows the time zone of the campaign the member is assigned to (India Standard Time when unassigned), returned as `timezone`. It acts as the API key's acting member, so it returns that member's own data, as an agent would see it in the calling workspace.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "Today's totals.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDailyStats"
                },
                "example": {
                  "timezone": "Asia/Kolkata",
                  "attempts": 42,
                  "connected": 18,
                  "completed": 40,
                  "talkSeconds": 3725
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/calling/daily-stats"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/calling/follow-ups": {
      "get": {
        "operationId": "listMyCallFollowUps",
        "summary": "List my call follow-ups",
        "description": "Lists open follow-ups (agreed callbacks) owned by the acting member, earliest due first, 20 per page. Paged with `offset`: pass `nextOffset` back as `offset` until it is `null`. Returns an empty list when the acting member cannot read leads. It acts as the API key's acting member, so it returns that member's own data, as an agent would see it in the calling workspace.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Items to skip. Pass the previous page's `nextOffset`.",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 100000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of open follow-ups.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanFollowUps"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/calling/follow-ups"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/calling/follow-ups/{callId}": {
      "put": {
        "operationId": "updateCallFollowUp",
        "summary": "Reschedule, complete or cancel a follow-up",
        "description": "Changes the follow-up created when the call identified by `callId` was saved with a callback. Only the follow-up's owner can change it; for anyone else it returns `404`.\n\n- `status: OPEN` with a new `dueAt` reschedules it and publishes `callback.scheduled` again with the same callback ID. `dueAt` must be in the future.\n- `status: DONE` marks it completed; `status: CANCELLED` drops it. Leave out `dueAt` for both.\n\nEach change is noted on the lead's timeline. Send the follow-up's current `revision` as `expectedRevision`; if it changed in the meantime the request fails with `409`. Repeating a change that was already applied returns the follow-up unchanged.\n\n**Scope:** `calling.write` (change calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateHumanFollowUp"
              },
              "example": {
                "expectedRevision": 1,
                "status": "OPEN",
                "dueAt": "2026-12-04T09:00:00.000Z"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated follow-up.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanFollowUp"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CALL_NOT_FOUND",
            "when": "The call does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/calling/follow-ups/{callId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/calling/break-reasons": {
      "get": {
        "operationId": "listBreakReasons",
        "summary": "List break reasons",
        "description": "Returns the workspace's break reasons, the choices an agent picks from when they pause calling (for example `MEAL` or `COACHING`), with the settings `revision`. Inactive reasons are kept so past breaks still report under their label.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "Break reasons.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreakSettings"
                },
                "example": {
                  "revision": 2,
                  "reasons": [
                    {
                      "key": "GENERAL",
                      "label": "General break",
                      "active": true
                    },
                    {
                      "key": "MEAL",
                      "label": "Lunch",
                      "active": true
                    },
                    {
                      "key": "COACHING",
                      "label": "Coaching",
                      "active": true
                    },
                    {
                      "key": "TRAINING",
                      "label": "Product training",
                      "active": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/calling/break-reasons"
      },
      "put": {
        "operationId": "saveBreakReasons",
        "summary": "Save break reasons",
        "description": "Replaces the workspace's list of break reasons (up to 30). Keys are upper-case codes and must be unique, and at least one reason must stay active. Retire a reason with `active: false` instead of removing it, so reports keep its label. Needs calling management permission. Send the current `revision` as `expectedRevision`; if someone saved in the meantime the request fails with `409`.\n\n**Scope:** `calling.write` (change calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveBreakSettings"
              },
              "example": {
                "expectedRevision": 2,
                "reasons": [
                  {
                    "key": "GENERAL",
                    "label": "General break",
                    "active": true
                  },
                  {
                    "key": "MEAL",
                    "label": "Lunch",
                    "active": true
                  },
                  {
                    "key": "COACHING",
                    "label": "Coaching",
                    "active": true
                  },
                  {
                    "key": "TRAINING",
                    "label": "Product training",
                    "active": true
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved break reasons.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreakSettings"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/calling/break-reasons"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/human-calls": {
      "get": {
        "operationId": "listLeadCalls",
        "summary": "List a lead's calls",
        "description": "Returns the 50 most recent agent calls with the lead, newest first, each with its state, timings, outcome and recording state. Members with calling management permission see every call; other members see only the calls they handled.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The lead's calls.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanCallHistory"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/leads/{leadId}/human-calls"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/human-calls/{callId}": {
      "get": {
        "operationId": "getCall",
        "summary": "Get a call",
        "description": "Returns one agent call. Members with calling management permission see every call; other members see only the calls they handled.\n\n`state` follows the telephony progress (`QUEUED` → `RINGING` → `BRIDGED` → `COMPLETED`, or `FAILED` / `CANCELLED`). `businessState` is what matters for follow-up work: `OPEN` while the call is live, `WRAP_UP` once it ended and is waiting for an outcome, `DONE` when the outcome is saved. `recordingState` becomes `AVAILABLE` when the recording can be downloaded. Use `revision` as `expectedRevision` when you save the outcome.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The call.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanCall"
                },
                "example": {
                  "id": "6f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f",
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "contactId": "3a9b8c7d-6e5f-4a1b-9c2d-8e7f6a5b4c3d",
                  "agentId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                  "externalCallId": "c0ffee00-1234-4abc-8def-0123456789ab",
                  "execution": {
                    "attemptId": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                    "revision": 4,
                    "code": "ANSWERED",
                    "customerDialed": "CONFIRMED"
                  },
                  "state": "COMPLETED",
                  "businessState": "WRAP_UP",
                  "classification": "HUMAN",
                  "createdAt": "2026-12-01T05:12:04.000Z",
                  "connectedAt": "2026-12-01T05:12:19.000Z",
                  "endedAt": "2026-12-01T05:18:42.000Z",
                  "outcome": null,
                  "dispositionKey": null,
                  "dispositionLabel": null,
                  "note": null,
                  "followUpScheduledAt": null,
                  "errorCode": null,
                  "revision": 7,
                  "recordingState": "PROCESSING",
                  "hangupPending": false,
                  "wrapUpAutoClosed": false,
                  "earlyMedia": false,
                  "answeringMachine": null,
                  "callerNumber": "+9180XXXX4521",
                  "direction": "OUTBOUND"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CALL_NOT_FOUND",
            "when": "The call does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/human-calls/{callId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/human-calls/{callId}/hangup": {
      "post": {
        "operationId": "hangUpCall",
        "summary": "Hang up a call",
        "description": "Asks telephony to end a live call. The request is queued and the call ends shortly after; the response shows the call as it is now, with `hangupPending: true` until the hang-up is confirmed. Repeating the request is safe, and a call that has already ended is returned unchanged. Needs call control permission and access to the call.\n\n**Scope:** `calling.write` (change calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "The hang-up was accepted; the call as it is now.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanCall"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.write",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CALL_NOT_FOUND",
            "when": "The call does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/human-calls/{callId}/hangup"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/human-calls/{callId}/outcome": {
      "post": {
        "operationId": "saveCallOutcome",
        "summary": "Save a call's outcome",
        "description": "Records how a finished call went and closes its wrap-up. The call must have ended (`businessState: WRAP_UP`); send its current `revision` as `expectedRevision`.\n\n- `outcome` is the reporting category. `dispositionKey` picks one of the campaign's dispositions with that outcome (leave it out to use the disposition whose key equals the outcome). When you send `dispositionKey`, also send the campaign's calling settings `revision` as `dispositionRevision`.\n- Some dispositions require a `note` or specific customer fields; send those fields in `customerFields` (this needs lead edit permission).\n- `CONNECTED` is accepted only when telephony confirmed a conversation.\n- `FOLLOW_UP_SCHEDULED` requires `followUpDueAt` (in the future) and `callback` with a reason and the customer's time zone. It creates a follow-up owned by the call's agent and a follow-up activity on the lead, which publishes `followup.created` and `callback.scheduled`. Any other outcome must leave both out.\n- `DO_NOT_CALL` marks the phone number as do-not-call across all campaigns and records the opt-out as withdrawn calling permission.\n\nSaving the outcome publishes `call.dispositioned`. `call.completed` is published when the call ends and `recording.available` when its recording can be downloaded, independently of the outcome.\n\nThe call is logged on the lead's timeline, and a call that settles an earlier callback to the same number completes that callback. Retrying with the same body returns the saved call; a different body after the outcome is saved fails with `409`.\n\nOther `409` causes: the call has not ended yet, its revision changed, the campaign's dispositions changed (reload the calling settings), or the lead moved to another campaign.\n\n**Scope:** `calling.write` (change calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteHumanCall"
              },
              "example": {
                "expectedRevision": 7,
                "outcome": "FOLLOW_UP_SCHEDULED",
                "dispositionKey": "FOLLOW_UP_SCHEDULED",
                "dispositionRevision": 3,
                "note": "Wants to discuss EMI options next week.",
                "followUpDueAt": "2026-12-03T06:30:00.000Z",
                "callback": {
                  "reason": "Discuss EMI options for the 5 kW system",
                  "timezone": "Asia/Kolkata"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The call with its saved outcome.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanCall"
                },
                "example": {
                  "id": "6f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f",
                  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "contactId": "3a9b8c7d-6e5f-4a1b-9c2d-8e7f6a5b4c3d",
                  "agentId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                  "externalCallId": "c0ffee00-1234-4abc-8def-0123456789ab",
                  "execution": {
                    "attemptId": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                    "revision": 4,
                    "code": "ANSWERED",
                    "customerDialed": "CONFIRMED"
                  },
                  "state": "COMPLETED",
                  "businessState": "DONE",
                  "classification": "HUMAN",
                  "createdAt": "2026-12-01T05:12:04.000Z",
                  "connectedAt": "2026-12-01T05:12:19.000Z",
                  "endedAt": "2026-12-01T05:18:42.000Z",
                  "outcome": "FOLLOW_UP_SCHEDULED",
                  "dispositionKey": "FOLLOW_UP_SCHEDULED",
                  "dispositionLabel": "Follow-up agreed",
                  "note": "Wants to discuss EMI options next week.",
                  "followUpScheduledAt": "2026-12-03T06:30:00.000Z",
                  "errorCode": null,
                  "revision": 8,
                  "recordingState": "AVAILABLE",
                  "hangupPending": false,
                  "wrapUpAutoClosed": false,
                  "earlyMedia": false,
                  "answeringMachine": null,
                  "callerNumber": "+9180XXXX4521",
                  "direction": "OUTBOUND"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CALL_NOT_FOUND",
            "when": "The call does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "OUTCOME_CONFLICT",
            "when": "A different outcome was already saved for this call."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/human-calls/{callId}/outcome"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/human-calls/{callId}/wrap-up": {
      "get": {
        "operationId": "getCallWrapUp",
        "summary": "Get a call's saved wrap-up",
        "description": "Returns exactly what was saved with the call's outcome: the disposition path, the customer form and values as they were at the time, the note and any callback. `snapshot` is `null` until the outcome is saved. `autoClosed: true` means the agent never saved an outcome and the campaign's fallback outcome was applied. Members with calling management permission see every call; other members see only the calls they handled.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The saved wrap-up.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanCallWrapUpHistory"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CALL_NOT_FOUND",
            "when": "The call does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/human-calls/{callId}/wrap-up"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/calls/{callId}/customer-form": {
      "get": {
        "operationId": "getCallCustomerForm",
        "summary": "Get the wrap-up form for a call",
        "description": "Returns what an agent needs to wrap up a call: the lead's customer form and current values (masked fields are listed in `maskedFields` and their values left out) and the campaign's calling settings, including its dispositions and their `revision`. Needs call control permission and access to the call. Returns `409` once the outcome is saved or when the lead moved to another campaign.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The wrap-up form.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentCallForm"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CALL_NOT_FOUND",
            "when": "The call does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/calls/{callId}/customer-form"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/call-eligibility": {
      "get": {
        "operationId": "getLeadCallEligibility",
        "summary": "Check whether a lead's numbers can be called",
        "description": "Evaluates every phone contact of the lead against the calling rules and returns, for each, whether it can be called now and if not, why and from when.\n\nRules checked include: do-not-call suppression (across all campaigns), recorded calling permission when the campaign requires consent, the campaign's calling hours and whether calling is running, paused cohorts, attempt limits per number and per 24 hours, retry delays after busy or unanswered calls, open calls, and agreed callbacks. `eligibleAt` is set when the number becomes callable at a known time.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Eligibility per phone contact.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactEligibilityList"
                },
                "example": {
                  "items": [
                    {
                      "contactId": "3a9b8c7d-6e5f-4a1b-9c2d-8e7f6a5b4c3d",
                      "reason": "RETRY_COOLDOWN",
                      "message": "Wait until the retry time before calling again.",
                      "eligibleAt": "2026-12-01T07:12:00.000Z",
                      "attempts": 2,
                      "attemptsIn24Hours": 2,
                      "consent": "UNKNOWN"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/leads/{leadId}/call-eligibility"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/leads/{leadId}/contacts/{contactId}/calling-permission": {
      "get": {
        "operationId": "getContactCallingPermission",
        "summary": "Get a number's calling permission",
        "description": "Returns the calling permission recorded for the contact's phone number: `UNKNOWN` (nothing recorded), `GRANTED` or `WITHDRAWN`, with the evidence and `revision`. Permission belongs to the number, so it applies to every lead with the same number. Needs calling management permission.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The calling permission.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactPermission"
                },
                "example": {
                  "status": "UNKNOWN",
                  "evidence": null,
                  "revision": 0
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "CONTACT_NOT_FOUND",
            "when": "The contact does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/leads/{leadId}/contacts/{contactId}/calling-permission"
      },
      "put": {
        "operationId": "saveContactCallingPermission",
        "summary": "Record a number's calling permission",
        "description": "Records that the customer granted or withdrew permission to be called on this number, with evidence of at least 10 characters (where and when consent was given or withdrawn). Permission belongs to the number and applies to every lead with it.\n\n- `WITHDRAWN` marks the number as do-not-call across all campaigns; it is no longer dialed.\n- `GRANTED` lifts a do-not-call mark recorded by an agent, and satisfies campaigns that require consent before calling.\n\nNeeds calling management permission. Send the current `revision` as `expectedRevision` (`0` when nothing is recorded); if it changed in the meantime the request fails with `409`.\n\n**Scope:** `calling.write` (change calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Lead ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveContactPermission"
              },
              "example": {
                "status": "GRANTED",
                "evidence": "Agreed on the recorded call of 28 Nov 2026.",
                "expectedRevision": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved calling permission.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactPermission"
                },
                "example": {
                  "status": "GRANTED",
                  "evidence": "Agreed on the recorded call of 28 Nov 2026.",
                  "revision": 1
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "LEAD_NOT_FOUND",
            "when": "The lead does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "CONTACT_NOT_FOUND",
            "when": "The contact does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "STALE_REVISION",
            "when": "The record changed after your read (`expectedRevision`); read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/leads/{leadId}/contacts/{contactId}/calling-permission"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/calling": {
      "get": {
        "operationId": "getCampaignCallingSettings",
        "summary": "Get a campaign's calling settings",
        "description": "Returns whether agent calling is enabled for the campaign, its purpose (service/transactional or promotional), its contact policy (consent requirement, attempt limits and retry delays) and its dispositions: the outcomes agents choose from, optionally nested up to four levels, with the customer fields each one requires. Use `revision` as `dispositionRevision` when saving a call outcome.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The campaign's calling settings.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanCallingCampaignResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/calling"
      },
      "put": {
        "operationId": "saveCampaignCallingSettings",
        "summary": "Save a campaign's calling settings",
        "description": "Enables or disables agent calling for the campaign and sets its purpose, contact policy and dispositions. Leave out `contactPolicy` or `dispositions` to keep the current ones.\n\nDispositions follow these rules: keys are unique; at least one active disposition must record a call without a conversation; an active do-not-call disposition must remain so agents can record opt-outs; existing dispositions cannot be removed or moved to another outcome (retire them with `active: false`); required customer fields must be active and visible to agents.\n\nNeeds calling or campaign management permission. Send the current `revision` as `expectedRevision`; a stale revision or a broken disposition rule returns `409`.\n\n**Scope:** `calling.write` (change calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HumanCallingCampaign"
              },
              "example": {
                "enabled": true,
                "purpose": "SERVICE_TRANSACTIONAL",
                "expectedRevision": 3,
                "contactPolicy": {
                  "automaticRetries": true,
                  "allowManualRedial": true,
                  "requireConsent": false,
                  "maxAttempts": 6,
                  "maxAttemptsPer24Hours": 2,
                  "busyDelayMinutes": 30,
                  "noAnswerDelayMinutes": 120
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved calling settings.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HumanCallingCampaignResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "CALL_SETTINGS_STALE",
            "when": "The settings changed after you read them; read them again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/campaigns/{campaignId}/calling"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/pacing": {
      "get": {
        "operationId": "getCampaignPacing",
        "summary": "Get a campaign's pacing",
        "description": "Returns the campaign's dialing policy and the latest pacing decision.\n\nThe policy covers the assigned agents, whether agents dial manually or receive calls automatically (`agentMode`), whether calling is `running`, calling hours (`timezone`, `days` with 0 = Sunday, and `startMinute`/`endMinute` in minutes after midnight, or `weeklyWindows`), and the pace: calls started per second (`cps`), calls per available agent (`dialRatio`) and the limit of calls in progress. `mode` controls pacing automation: `OBSERVE` only measures, `RECOMMEND` suggests values, `AUTOMATIC` adjusts the pace itself.\n\n`decision` holds the latest measurement (answer rate, talk and wrap-up times, recommended pace and telephony capacity); it is `null` until pacing has run.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The pacing policy and latest decision.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DialerStatus"
                },
                "example": {
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "revision": 4,
                  "policy": {
                    "agentIds": [
                      "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "5e4d3c2b-1a09-4876-b543-210fedcba987"
                    ],
                    "agentMode": "PROGRESSIVE",
                    "intervalSeconds": 10,
                    "poolId": null,
                    "edgeGroup": null,
                    "running": true,
                    "mode": "RECOMMEND",
                    "cps": 2,
                    "dialRatio": 1,
                    "outstandingLimit": 20,
                    "priority": 1,
                    "waitingLimit": 0,
                    "maxWaitSeconds": 10,
                    "timezone": "Asia/Kolkata",
                    "days": [
                      1,
                      2,
                      3,
                      4,
                      5,
                      6
                    ],
                    "startMinute": 570,
                    "endMinute": 1140
                  },
                  "decision": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/pacing"
      },
      "put": {
        "operationId": "saveCampaignPacing",
        "summary": "Save a campaign's pacing",
        "description": "Replaces the campaign's dialing policy: assigned agents, agent mode, calling hours, pace and automation mode (see **Get a campaign's pacing**). Set `running: false` to pause new calls at once; calls already in progress continue.\n\nEvery newly assigned agent must be an active member with calling permission and an enabled phone. `AUTOMATIC` mode can only be turned on after the campaign has run in `RECOMMEND` mode.\n\nNeeds calling or campaign management permission. Send the current `revision` as `expectedRevision`. Returns `409` when the revision is stale, an agent cannot take calls, the automation step is skipped, or a customer-first pool is changed or already used by another campaign.\n\n**Scope:** `calling.write` (change calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveDialerPolicy"
              },
              "example": {
                "expectedRevision": 4,
                "policy": {
                  "agentIds": [
                    "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                    "5e4d3c2b-1a09-4876-b543-210fedcba987"
                  ],
                  "agentMode": "PROGRESSIVE",
                  "intervalSeconds": 10,
                  "running": true,
                  "mode": "RECOMMEND",
                  "cps": 2,
                  "dialRatio": 1.5,
                  "outstandingLimit": 20,
                  "timezone": "Asia/Kolkata",
                  "days": [
                    1,
                    2,
                    3,
                    4,
                    5,
                    6
                  ],
                  "startMinute": 570,
                  "endMinute": 1140
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved pacing policy.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DialerStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/campaigns/{campaignId}/pacing"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/agents": {
      "get": {
        "operationId": "getCampaignAgentBoard",
        "summary": "Get live agent states for a campaign",
        "description": "Returns every agent assigned to the campaign with their live state (`ON_CALL`, `WRAP_UP`, `IDLE`, `BREAK`, `OFFLINE` or `UNAVAILABLE`), since when, the current call and lead, and the break or unavailability reason, plus a count per state. `streamHealthy: false` means live updates from telephony are delayed, so states may be stale. Needs calling or campaign management permission.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Live agent states.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignAgentDashboard"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/agents"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/agent-options": {
      "get": {
        "operationId": "listCampaignAgentOptions",
        "summary": "List members who can be assigned to a campaign",
        "description": "Lists active members with calling permission and an enabled phone, the people you can put in the pacing policy's `agentIds`. Agents already assigned to this campaign come first and are always included; `search` filters the others by name. Returns up to 500 members. Needs calling or campaign management permission.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Part of a member's name. Empty returns every eligible member.",
            "schema": {
              "default": "",
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Assignable members.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignAgentOptions"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/agent-options"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/calling-cohorts": {
      "get": {
        "operationId": "listCallingCohorts",
        "summary": "List calling cohorts",
        "description": "Lists the campaign's calling cohorts. A cohort is a named group of leads, either one import batch or a hand-picked list, that you can pause and resume together: leads in a disabled cohort are not dialed. Each cohort shows its current lead count. Needs calling management permission.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The campaign's cohorts.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallingCohorts"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/calling-cohorts"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/calling-cohort-options": {
      "get": {
        "operationId": "listCallingCohortOptions",
        "summary": "List leads and batches for calling cohorts",
        "description": "Lists what a cohort can be built from: the campaign's leads (newest first, 100 per page) and the 100 most recent import batches that contain the campaign's leads. Paged with `offset`: pass `nextOffset` back as `offset` until it is `null`. The offset pages the leads only. Needs calling management permission.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Items to skip. Pass the previous page's `nextOffset`.",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 100000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Leads and batches.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallingCohortOptions"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/calling-cohort-options"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/calling-cohorts/{cohortId}": {
      "put": {
        "operationId": "saveCallingCohort",
        "summary": "Create or update a calling cohort",
        "description": "Creates the cohort with the ID you choose (a new UUID, with `expectedRevision: 0`) or updates it. Give either a `batchId` or up to 1,000 `leadIds` from the campaign, not both. `enabled: false` pauses calling for its leads. A campaign can have up to 100 cohorts. Needs calling management permission. A stale `expectedRevision` or the cohort limit returns `409`.\n\n**Scope:** `calling.write` (change calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cohortId",
            "in": "path",
            "required": true,
            "description": "Calling cohort ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCallingCohort"
              },
              "example": {
                "expectedRevision": 0,
                "name": "Pune solar expo walk-ins",
                "enabled": false,
                "batchId": "8a7b6c5d-4e3f-4a2b-9c1d-0e9f8a7b6c5d",
                "leadIds": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "All of the campaign's cohorts after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallingCohorts"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/campaigns/{campaignId}/calling-cohorts/{cohortId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/calling-work-queue": {
      "get": {
        "operationId": "listCallingWorkQueue",
        "summary": "List calling work that needs attention",
        "description": "Returns one of two supervisor queues, 50 items per page. `OVERDUE_CALLBACKS` lists open callbacks past their due time, oldest first, with owner and reason. `RETRY_EXHAUSTED` lists phone numbers that reached the campaign's attempt or technical retry limit and will not be dialed again automatically. Paged with `offset`: pass `nextOffset` back as `offset` until it is `null`. Needs calling management permission.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "`OVERDUE_CALLBACKS` (callbacks past due) or `RETRY_EXHAUSTED` (leads that used up their call attempts).",
            "schema": {
              "default": "OVERDUE_CALLBACKS",
              "type": "string",
              "enum": [
                "OVERDUE_CALLBACKS",
                "RETRY_EXHAUSTED"
              ]
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Rows to skip, for paging (use `nextOffset`).",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 100000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the queue.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallingWorkQueue"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/calling-work-queue"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/calling-reassignment-options": {
      "get": {
        "operationId": "listCallbackReassignmentOptions",
        "summary": "List agents who can take over callbacks",
        "description": "Lists the team and member pairs that can take over a lead's callbacks: active agents assigned to the campaign, with calling permission and an enabled phone, in each active team they belong to. Use a pair with **Reassign a callback**. Needs calling management permission.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Possible new owners.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallingReassignmentOptions"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/calling-reassignment-options"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/calling-work-owner": {
      "put": {
        "operationId": "reassignCallback",
        "summary": "Reassign a callback",
        "description": "Hands an open callback, identified by its call, to another agent. The lead is assigned to the chosen team and member (publishing `lead.assigned`) and every open callback for the lead moves to that member.\n\nNeeds calling management and lead edit permissions. Send the callback's current `revision` (from the work queue) as `expectedRevision`. Returns `409` when the callback changed, the agent is not an option for this campaign and team, or the lead has a call still open.\n\n**Scope:** `calling.write` (change calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReassignCallingWork"
              },
              "example": {
                "callId": "6f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f",
                "expectedRevision": 2,
                "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                "userId": "5e4d3c2b-1a09-4876-b543-210fedcba987"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The callback was reassigned.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallingWorkReassigned"
                },
                "example": {
                  "saved": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/campaigns/{campaignId}/calling-work-owner"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/calling-report": {
      "get": {
        "operationId": "getAgentActivityReport",
        "summary": "Get an agent activity report",
        "description": "Reports how each agent in the campaign spent a period of up to 31 days: a timeline of states (ready, ringing, talking, wrap-up, break, offline), seconds per state, and counts of attempts, conversations, retries and callbacks scheduled, completed and overdue. Filter to one agent with `userId`. Agents are paged with `offset`; pass `nextOffset` back until it is `null`. Needs calling management permission.\n\n**Scope:** `calling.read` (read calling).",
        "tags": [
          "Calling"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Start of the report period (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "End of the report period (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "description": "Only this agent.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Agents to skip, for paging (use `nextOffset`).",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 100000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The activity report.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallingReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "calling.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "calling.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `calling.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/calling-report"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/cdr": {
      "get": {
        "operationId": "listCallDetailRecords",
        "summary": "List call detail records",
        "description": "Returns one row per call in the campaign for a reporting period, with every field of the campaign's report catalogue (see **List report fields**) as a cell. Each cell has a `status`: only `VALUE` cells carry a value; masked customer fields come back as `MASKED`.\n\n`from` and `to` are ISO 8601 timestamps with an offset; the period must have started and may span at most 31 days. `timeBasis` chooses whether a call counts by when it was requested, when it ended, or whether it was active at any point in the period. Filter by call state, agent, lead, disposition or whether the wrap-up is recorded. Pages of up to 100 rows use an opaque cursor: pass `nextCursor` back as `cursor` with the same filters until it is `null`.\n\nThis is a live view: rows can change while a call is in progress or telephony data catches up (`telephonySync`). For a fixed file, create an export. A very broad query can time out with `503`; narrow the period or filters and retry. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.read` (read reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sort direction.",
            "schema": {
              "default": "NEWEST",
              "type": "string",
              "enum": [
                "NEWEST",
                "OLDEST"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Current state of the call detail record.",
            "schema": {
              "type": "string",
              "enum": [
                "REQUESTED",
                "QUEUED",
                "DISPATCHED",
                "AGENT_CONNECTING",
                "CUSTOMER_DIALING",
                "RINGING",
                "MEDIA_ANSWERED",
                "SCREENING",
                "HUMAN_CONFIRMED",
                "BRIDGED",
                "ENDING",
                "COMPLETED",
                "FAILED",
                "CANCELLED",
                "UNCERTAIN"
              ]
            }
          },
          {
            "name": "agentId",
            "in": "query",
            "required": false,
            "description": "ID of the agent.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "leadId",
            "in": "query",
            "required": false,
            "description": "ID of the lead.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "wrapUp",
            "in": "query",
            "required": false,
            "description": "`ALL`, `RECORDED` (wrap-up saved) or `AWAITING` (wrap-up still due).",
            "schema": {
              "default": "ALL",
              "type": "string",
              "enum": [
                "ALL",
                "RECORDED",
                "AWAITING"
              ]
            }
          },
          {
            "name": "dispositionKey",
            "in": "query",
            "required": false,
            "description": "Only calls with this disposition key.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Start of the period (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "End of the period (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "timeBasis",
            "in": "query",
            "required": false,
            "description": "Which call time the period filters on: when the call was created, when it ended, or any time it was active.",
            "schema": {
              "default": "CALL_CREATED",
              "type": "string",
              "enum": [
                "CALL_CREATED",
                "CALL_ENDED",
                "ACTIVE_DURING"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1500,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of call records.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdrPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/cdr"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/cdr/fields": {
      "get": {
        "operationId": "listCdrFields",
        "summary": "List report fields",
        "description": "Returns the campaign's report catalogue: every field a call record, template or export can contain (call facts, timings, disposition, callback and the campaign's customer fields), with its type, group and whether it is masked or only available for older calls. Use the field IDs as column keys in templates and exports. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.read` (read reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The report catalogue.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdrCatalogue"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/cdr/fields"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/cdr/summary": {
      "get": {
        "operationId": "getCdrSummary",
        "summary": "Summarise calls by lead or account",
        "description": "Groups the campaign's calls for a reporting period by lead, or by account using a customer field you choose (`groupBy: ACCOUNT` with `accountFieldKey`), with totals per group and overall: requests, ended, open, uncertain and failed calls, wrap-ups recorded and awaited, and open and overdue callbacks.\n\n`from` and `to` are ISO 8601 timestamps with an offset; the period must have started and may span at most 31 days. `timeBasis` chooses whether a call counts by when it was requested, when it ended, or whether it was active at any point in the period. Groups are paged with `cursor` / `nextCursor`. A summary covering more than 10,000 leads is refused with `400`; narrow the period or filters. If the data changes while you page, the next page returns `409`; start again from the first page. A very broad query can time out with `503`; narrow the period or filters and retry. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.read` (read reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "Sort direction.",
            "schema": {
              "default": "NEWEST",
              "type": "string",
              "enum": [
                "NEWEST",
                "OLDEST"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Current state of the call detail record.",
            "schema": {
              "type": "string",
              "enum": [
                "REQUESTED",
                "QUEUED",
                "DISPATCHED",
                "AGENT_CONNECTING",
                "CUSTOMER_DIALING",
                "RINGING",
                "MEDIA_ANSWERED",
                "SCREENING",
                "HUMAN_CONFIRMED",
                "BRIDGED",
                "ENDING",
                "COMPLETED",
                "FAILED",
                "CANCELLED",
                "UNCERTAIN"
              ]
            }
          },
          {
            "name": "agentId",
            "in": "query",
            "required": false,
            "description": "ID of the agent.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "leadId",
            "in": "query",
            "required": false,
            "description": "ID of the lead.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "wrapUp",
            "in": "query",
            "required": false,
            "description": "`ALL`, `RECORDED` (wrap-up saved) or `AWAITING` (wrap-up still due).",
            "schema": {
              "default": "ALL",
              "type": "string",
              "enum": [
                "ALL",
                "RECORDED",
                "AWAITING"
              ]
            }
          },
          {
            "name": "dispositionKey",
            "in": "query",
            "required": false,
            "description": "Only calls with this disposition key.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Start of the period (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "End of the period (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "timeBasis",
            "in": "query",
            "required": false,
            "description": "Which call time the period filters on: when the call was created, when it ended, or any time it was active.",
            "schema": {
              "default": "CALL_CREATED",
              "type": "string",
              "enum": [
                "CALL_CREATED",
                "CALL_ENDED",
                "ACTIVE_DURING"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1500,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          },
          {
            "name": "groupBy",
            "in": "query",
            "required": false,
            "description": "`LEAD` or `ACCOUNT` (grouped by a customer field).",
            "schema": {
              "default": "LEAD",
              "type": "string",
              "enum": [
                "LEAD",
                "ACCOUNT"
              ]
            }
          },
          {
            "name": "accountFieldKey",
            "in": "query",
            "required": false,
            "description": "Customer field to group by; required when `groupBy` is `ACCOUNT`, refused otherwise.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the summary.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdrSummaryPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/cdr/summary"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/cdr/calls/{callId}/history": {
      "get": {
        "operationId": "getCallDetailHistory",
        "summary": "Get earlier calls with the same lead",
        "description": "Returns the record of one call (`anchor`) followed by the lead's earlier calls in the same campaign, newest first, so you can compare what changed between wrap-ups. Paged with `cursor` / `nextCursor`, up to 50 per page. A very broad query can time out with `503`; narrow the period or filters and retry. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.read` (read reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "description": "Call ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1500,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The call and earlier calls.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdrHistoryPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "CALL_NOT_FOUND",
            "when": "The call does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/cdr/calls/{callId}/history"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/cdr/templates": {
      "get": {
        "operationId": "listCdrTemplates",
        "summary": "List report templates",
        "description": "Lists saved report layouts for the campaign's process: your own templates and those shared with the process. `canEdit` is `true` for templates the acting member owns. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.read` (read reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Report templates.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdrTemplates"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/cdr/templates"
      },
      "put": {
        "operationId": "saveCdrTemplate",
        "summary": "Create or update a report template",
        "description": "Saves a report layout: the columns (field IDs from **List report fields**, each with a heading), an optional business identifier column, the time basis and default filters. Templates belong to the campaign's process, so they work for every campaign of that process. `PRIVATE` templates are visible only to their owner; `PROCESS` templates are shared.\n\nTo create, choose a new UUID as `id` and send `expectedRevision: 0`; to update, send the template's current `revision`. Only the owner can update a template. A stale revision, or the limit of 200 templates per process, returns `409`. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.write` (manage reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCdrTemplate"
              },
              "example": {
                "id": "1d2c3b4a-5f6e-4d7c-a8b9-c0d1e2f3a4b5",
                "expectedRevision": 0,
                "name": "Daily agent call log",
                "visibility": "PROCESS",
                "definition": {
                  "version": 1,
                  "columns": [
                    {
                      "key": "call.createdAt",
                      "type": "DATETIME",
                      "heading": "Call time"
                    },
                    {
                      "key": "call.id",
                      "type": "TEXT",
                      "heading": "Call ID"
                    },
                    {
                      "key": "agent.name",
                      "type": "TEXT",
                      "heading": "Agent"
                    },
                    {
                      "key": "disposition.key",
                      "type": "TEXT",
                      "heading": "Disposition"
                    },
                    {
                      "key": "call.connectionSeconds",
                      "type": "NUMBER",
                      "heading": "Talk time (s)"
                    }
                  ],
                  "primaryKey": null,
                  "timeBasis": "CALL_CREATED",
                  "selection": {
                    "order": "NEWEST",
                    "wrapUp": "RECORDED"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved template.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdrTemplate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "CDR_TEMPLATE_CONFLICT",
            "when": "The template changed after you read it, or its name is taken."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/campaigns/{campaignId}/cdr/templates"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/cdr/templates/{templateId}": {
      "delete": {
        "operationId": "deleteCdrTemplate",
        "summary": "Delete a report template",
        "description": "Removes a template you own. Send its current `revision` as `expectedRevision`; a stale revision, or a template that is not yours or already removed, returns `409`. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.write` (manage reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "templateId",
            "in": "path",
            "required": true,
            "description": "Report template ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteCdrTemplate"
              },
              "example": {
                "expectedRevision": 3
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The template was removed.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "TEMPLATE_NOT_FOUND",
            "when": "The report template does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "CDR_TEMPLATE_CONFLICT",
            "when": "The template changed after you read it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "DELETE /lms/campaigns/{campaignId}/cdr/templates/{templateId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/cdr/exports": {
      "post": {
        "operationId": "createCdrExport",
        "summary": "Create a report export",
        "description": "Starts building a CSV or Excel file of the campaign's call records for a period of up to 31 days, laid out by `definition` (the same shape as a template). `view` chooses one row per call (`CALLS`), per lead (`LEAD`) or per account (`ACCOUNT`, with `accountFieldKey`).\n\nThe export runs in the background. Poll **Get a report export** until `state` is `READY` (or `FAILED`), then download it. Files are available for 24 hours after the request, then `EXPIRED`. Exports hold up to 100,000 rows.\n\nChoose a new UUID as `id`: it makes the request safe to retry. Repeating the same request returns the existing export; reusing the `id` with a different request returns `409`.\n\nLimits: 2 exports in progress per member, 5 per workspace, and 20 requests per member per day; beyond that the request returns `429`. Returns `503` when export storage is not configured. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.write` (manage reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CdrExportRequest"
              },
              "example": {
                "id": "7c6b5a49-3d2e-4f1a-8b9c-0d1e2f3a4b5c",
                "format": "CSV",
                "view": "CALLS",
                "definition": {
                  "version": 1,
                  "columns": [
                    {
                      "key": "call.createdAt",
                      "type": "DATETIME",
                      "heading": "Call time"
                    },
                    {
                      "key": "call.id",
                      "type": "TEXT",
                      "heading": "Call ID"
                    },
                    {
                      "key": "agent.name",
                      "type": "TEXT",
                      "heading": "Agent"
                    },
                    {
                      "key": "disposition.key",
                      "type": "TEXT",
                      "heading": "Disposition"
                    },
                    {
                      "key": "call.connectionSeconds",
                      "type": "NUMBER",
                      "heading": "Talk time (s)"
                    }
                  ],
                  "primaryKey": null,
                  "timeBasis": "CALL_CREATED",
                  "selection": {
                    "order": "NEWEST",
                    "wrapUp": "RECORDED"
                  }
                },
                "from": "2026-11-01T00:00:00+05:30",
                "to": "2026-12-01T00:00:00+05:30"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The export was accepted (or already existed).",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdrExport"
                },
                "example": {
                  "id": "7c6b5a49-3d2e-4f1a-8b9c-0d1e2f3a4b5c",
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "format": "CSV",
                  "view": "CALLS",
                  "state": "QUEUED",
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "capturedAt": null,
                  "expiresAt": "2026-12-02T10:00:00.000Z",
                  "rowCount": null,
                  "byteLength": null,
                  "sha256": null,
                  "errorCode": null,
                  "from": "2026-11-01T00:00:00+05:30",
                  "to": "2026-12-01T00:00:00+05:30"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "POST /lms/campaigns/{campaignId}/cdr/exports"
      },
      "get": {
        "operationId": "listCdrExports",
        "summary": "List report exports",
        "description": "Lists the acting member's 50 most recent exports for the campaign, newest first, with their state. `enabled: false` means export storage is not configured, so new exports cannot be created. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.read` (read reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recent exports.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdrExports"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/cdr/exports"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/cdr/exports/{exportId}": {
      "get": {
        "operationId": "getCdrExport",
        "summary": "Get a report export",
        "description": "Returns one of the acting member's exports. `state` moves from `QUEUED` to `PROCESSING` to `READY`, or ends as `FAILED` (see `errorCode`), `CANCELLED` or `EXPIRED`. When `READY`, `rowCount`, `byteLength` and `sha256` describe the file. Poll every few seconds while it is queued or processing. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.read` (read reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "exportId",
            "in": "path",
            "required": true,
            "description": "Export ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The export.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CdrExport"
                },
                "example": {
                  "id": "7c6b5a49-3d2e-4f1a-8b9c-0d1e2f3a4b5c",
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "format": "CSV",
                  "view": "CALLS",
                  "state": "READY",
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "capturedAt": "2026-12-01T10:00:07.000Z",
                  "expiresAt": "2026-12-02T10:00:00.000Z",
                  "rowCount": 1842,
                  "byteLength": 412311,
                  "sha256": "9f2c4e1a7b3d5f6e8a0c2b4d6f8e1a3c5b7d9f0e2a4c6b8d0f1e3a5c7b9d2f4e",
                  "errorCode": null,
                  "from": "2026-11-01T00:00:00+05:30",
                  "to": "2026-12-01T00:00:00+05:30"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "CDR_EXPORT_NOT_FOUND",
            "when": "The export does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/cdr/exports/{exportId}"
      },
      "delete": {
        "operationId": "cancelCdrExport",
        "summary": "Cancel or discard a report export",
        "description": "Cancels an export that is still running, or discards a finished one so it can no longer be downloaded. Cancelling an export that is already cancelled or expired succeeds without change. The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.write` (manage reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "exportId",
            "in": "path",
            "required": true,
            "description": "Export ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The export was cancelled.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.write",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "CDR_EXPORT_NOT_FOUND",
            "when": "The export does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "DELETE /lms/campaigns/{campaignId}/cdr/exports/{exportId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/cdr/exports/{exportId}/download": {
      "get": {
        "operationId": "downloadCdrExport",
        "summary": "Download a report export",
        "description": "Streams the finished file as an attachment: `text/csv; charset=utf-8` for CSV exports, `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` for Excel exports. Compare `X-Report-SHA256` with the export's `sha256` to verify it. Returns `409` while the export is not `READY`, or when the workspace's customer field masking changed since it was built (create a new export); `410` once it has expired; `503` when the file cannot be read from storage (retry later). The acting member needs both calling management and lead read permissions.\n\n**Scope:** `reports.read` (read reports).",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "exportId",
            "in": "path",
            "required": true,
            "description": "Export ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The export file.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Content-Disposition": {
                "description": "Always `attachment; filename=\"cdr-<exportId>.<csv|xlsx>\"`.",
                "schema": {
                  "type": "string"
                }
              },
              "Content-Length": {
                "description": "File size in bytes.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Report-SHA256": {
                "description": "SHA-256 of the file, as lowercase hex.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "text/csv"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "reports.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "reports.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `reports.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "CDR_EXPORT_NOT_FOUND",
            "when": "The export does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 410,
            "code": "CURSOR_EXPIRED",
            "when": "The cursor is older than the 30-day retention. Take a fresh cursor and reconcile mirrored records: [Retention and recovery](/developers/pagination#retention)."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/cdr/exports/{exportId}/download"
      }
    },
    "/v1/tenants/{tenantSlug}/processes": {
      "get": {
        "operationId": "listProcesses",
        "summary": "List processes",
        "description": "Lists the workspace's processes, optionally only active or archived ones. A process holds the pipeline stages, identity rules and campaigns of one line of business. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `campaigns.read` (read campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the process.",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of processes.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /processes"
      },
      "post": {
        "operationId": "createProcess",
        "summary": "Create a process",
        "description": "Creates an active process. Names are unique among active processes (`409` otherwise). The workspace's plan caps the number of active processes; at the cap the request fails with `409` and `error.details` carries the current count and limit.\n\n**Scope:** `campaigns.write` (change campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProcessRequest"
              },
              "example": {
                "name": "Solar Sales",
                "description": "Home solar, from enquiry to install.",
                "timezone": "Asia/Kolkata"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new process.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Location": {
                "description": "URL of the new process.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessResponse"
                },
                "example": {
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "description": "Home solar, from enquiry to install.",
                  "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                  "name": "Solar Sales",
                  "status": "ACTIVE",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "timezone": "Asia/Kolkata",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 409,
            "code": "PROCESS_NAME_CONFLICT",
            "when": "Another process already has this name."
          },
          {
            "status": 409,
            "code": "PROCESS_LIMIT_REACHED",
            "when": "The workspace has reached its plan's process limit."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /processes"
      }
    },
    "/v1/tenants/{tenantSlug}/processes/{processId}": {
      "get": {
        "operationId": "getProcess",
        "summary": "Get a process",
        "description": "**Scope:** `campaigns.read` (read campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "description": "Process ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The process.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessResponse"
                },
                "example": {
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "description": "Home solar, from enquiry to install.",
                  "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                  "name": "Solar Sales",
                  "status": "ACTIVE",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "timezone": "Asia/Kolkata",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "PROCESS_NOT_FOUND",
            "when": "The process does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /processes/{processId}"
      },
      "patch": {
        "operationId": "updateProcess",
        "summary": "Update a process",
        "description": "Changes a process's name, description or time zone. Send only the fields to change. Archived processes cannot be changed (`409`).\n\n**Scope:** `campaigns.write` (change campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "description": "Process ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProcessRequest"
              },
              "example": {
                "description": "Residential and small-business solar sales."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated process.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "PROCESS_NOT_FOUND",
            "when": "The process does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "PROCESS_NAME_CONFLICT",
            "when": "Another process already has this name."
          },
          {
            "status": 409,
            "code": "PROCESS_ARCHIVED",
            "when": "Archived processes cannot be changed."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /processes/{processId}"
      },
      "delete": {
        "operationId": "archiveProcess",
        "summary": "Archive a process",
        "description": "Archives the process. Nothing is deleted: the process and its history remain readable, but it can no longer be changed. Archiving an archived process succeeds without changes.\n\n**Scope:** `campaigns.write` (change campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "processId",
            "in": "path",
            "required": true,
            "description": "Process ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The process is archived.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.write",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "PROCESS_NOT_FOUND",
            "when": "The process does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "DELETE /processes/{processId}"
      }
    },
    "/v1/tenants/{tenantSlug}/campaigns": {
      "get": {
        "operationId": "listCampaigns",
        "summary": "List campaigns",
        "description": "Lists campaigns, optionally filtered by process and status. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `campaigns.read` (read campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "processId",
            "in": "query",
            "required": false,
            "description": "ID of the process.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the campaign.",
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "ACTIVE",
                "PAUSED",
                "ARCHIVED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of campaigns.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /campaigns"
      },
      "post": {
        "operationId": "createCampaign",
        "summary": "Create a campaign",
        "description": "Creates a campaign in a process. New campaigns start in `DRAFT`; enable at least one module with **Enable or disable a campaign module**, then set `status` to `ACTIVE` with **Update a campaign**.\n\n`startsAt` must be before `endsAt` when both are set. Names are unique among the process's non-archived campaigns (`409` otherwise). An unknown `processId` returns `404`.\n\n**Scope:** `campaigns.write` (change campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCampaignRequest"
              },
              "example": {
                "name": "Rooftop Solar Pune Q1",
                "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                "description": "Rooftop solar enquiries from Pune.",
                "timezone": "Asia/Kolkata",
                "startsAt": "2027-01-01T00:00:00+05:30",
                "endsAt": "2027-03-31T23:59:59+05:30"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new campaign.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Location": {
                "description": "URL of the new campaign.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignResponse"
                },
                "example": {
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "description": "Rooftop solar enquiries from Pune.",
                  "endsAt": "2027-03-31T23:59:59+05:30",
                  "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "name": "Rooftop Solar Pune Q1",
                  "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                  "startsAt": "2027-01-01T00:00:00+05:30",
                  "status": "DRAFT",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "timezone": "Asia/Kolkata",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "CAMPAIGN_NAME_CONFLICT",
            "when": "Another campaign already has this name."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /campaigns"
      }
    },
    "/v1/tenants/{tenantSlug}/campaigns/{campaignId}": {
      "get": {
        "operationId": "getCampaign",
        "summary": "Get a campaign",
        "description": "**Scope:** `campaigns.read` (read campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The campaign.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignResponse"
                },
                "example": {
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "description": "Rooftop solar enquiries from Pune.",
                  "endsAt": "2027-03-31T23:59:59+05:30",
                  "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "name": "Rooftop Solar Pune Q1",
                  "processId": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                  "startsAt": "2027-01-01T00:00:00+05:30",
                  "status": "DRAFT",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "timezone": "Asia/Kolkata",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /campaigns/{campaignId}"
      },
      "patch": {
        "operationId": "updateCampaign",
        "summary": "Update a campaign",
        "description": "Changes campaign fields or moves it through its lifecycle. Send only the fields to change.\n\nAllowed status changes: `DRAFT` → `ACTIVE` or `ARCHIVED`; `ACTIVE` ↔ `PAUSED`; any → `ARCHIVED`. An `ACTIVE` campaign needs at least one enabled module. Archived campaigns cannot be changed. These rules, and a duplicate name, return `409`.\n\n**Scope:** `campaigns.write` (change campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCampaignRequest"
              },
              "example": {
                "status": "ACTIVE"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated campaign.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "CAMPAIGN_NAME_CONFLICT",
            "when": "Another campaign already has this name."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /campaigns/{campaignId}"
      }
    },
    "/v1/tenants/{tenantSlug}/campaigns/{campaignId}/modules": {
      "get": {
        "operationId": "listCampaignModules",
        "summary": "List a campaign's modules",
        "description": "Shows which modules (`LMS`, `DIALER`, `QMS`, `IVR`, `VOICEBOT`) are enabled for the campaign. Features such as Voicebot calling only work for a campaign whose module is enabled.\n\n**Scope:** `campaigns.read` (read campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The campaign's modules.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CampaignModuleResponse"
                  }
                },
                "example": [
                  {
                    "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                    "enabled": true,
                    "module": "LMS",
                    "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                    "updatedAt": "2026-12-01T10:05:00.000Z"
                  },
                  {
                    "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                    "enabled": true,
                    "module": "VOICEBOT",
                    "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                    "updatedAt": "2026-12-01T10:05:00.000Z"
                  },
                  {
                    "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                    "enabled": false,
                    "module": "QMS",
                    "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                    "updatedAt": "2026-12-01T10:05:00.000Z"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /campaigns/{campaignId}/modules"
      }
    },
    "/v1/tenants/{tenantSlug}/campaigns/{campaignId}/modules/{module}": {
      "put": {
        "operationId": "setCampaignModule",
        "summary": "Enable or disable a campaign module",
        "description": "Turns one module on or off for the campaign. Enabling a module the workspace's plan does not include returns `403` with `WORKSPACE_NOT_ENTITLED`. Disabling the last enabled module of an `ACTIVE` campaign, or changing an archived campaign, returns `409`. Setting a module to its current state changes nothing.\n\n**Scope:** `campaigns.write` (change campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "module",
            "in": "path",
            "required": true,
            "description": "Campaign module.",
            "schema": {
              "type": "string",
              "enum": [
                "LMS",
                "DIALER",
                "QMS",
                "IVR",
                "VOICEBOT"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CampaignModuleUpdateRequest"
              },
              "example": {
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The module's new state.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignModuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /campaigns/{campaignId}/modules/{module}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/campaigns/{campaignId}/customer-form": {
      "get": {
        "operationId": "getCampaignCustomerForm",
        "summary": "Get a campaign's customer form",
        "description": "Returns the customer form: the extra fields captured for each lead of the campaign, in display order. A campaign without a form returns an empty field list at `revision` 0. Lead values are read and saved with **Get a lead's customer fields** and **Save a lead's customer fields**.\n\n**Scope:** `campaigns.read` (read campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer form.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignCustomerForm"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/campaigns/{campaignId}/customer-form"
      },
      "put": {
        "operationId": "saveCampaignCustomerForm",
        "summary": "Save a campaign's customer form",
        "description": "Replaces the form's field list (up to 60 fields with unique `key`s). `SELECT` and `MULTI_SELECT` fields need at least one option; other types take none. To retire a field without losing saved values, set `active: false` rather than removing it. Send the form's current `revision` as `expectedRevision`; a stale revision returns `409`.\n\n**Scope:** `campaigns.write` (change campaigns).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCampaignCustomerForm"
              },
              "example": {
                "expectedRevision": 3,
                "fields": [
                  {
                    "key": "monthly_bill",
                    "label": "Average monthly electricity bill (INR)",
                    "type": "NUMBER",
                    "required": true
                  },
                  {
                    "key": "roof_type",
                    "label": "Roof type",
                    "type": "SELECT",
                    "options": [
                      {
                        "value": "rcc",
                        "label": "RCC slab"
                      },
                      {
                        "value": "tin",
                        "label": "Tin sheet"
                      }
                    ]
                  },
                  {
                    "key": "site_visit_date",
                    "label": "Preferred site visit date",
                    "type": "DATE"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved form.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignCustomerForm"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "campaigns.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "campaigns.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `campaigns.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "CUSTOMER_FORM_STALE",
            "when": "The form changed after you read it; read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/campaigns/{campaignId}/customer-form"
      }
    },
    "/v1/tenants/{tenantSlug}/qms": {
      "get": {
        "operationId": "listQualityReviews",
        "summary": "List quality reviews",
        "description": "Returns one page of the quality review queue (50 reviews, newest first) with queue totals in `report`. Page with `offset` while `hasMore` is `true`. For managers the response also carries the scorecards, per-campaign settings, campaigns and eligible reviewers; for other roles those lists are empty. The acting member needs a quality role. Managers see every review; reviewers see the reviews assigned to them; agents see only their own submitted reviews.\n\n**Scope:** `quality.read` (read quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of reviews to skip. Pages hold 50 reviews.",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "description": "Only reviews of this campaign.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "`reviewed`: submitted reviews only; `pending`: everything else.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "reviewed"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of reviews.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QmsOverview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /qms"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/cases/{id}": {
      "get": {
        "operationId": "getQualityReview",
        "summary": "Get a quality review",
        "description": "Returns one review: the call, the scorecard it is scored against, automatic analysis (transcript, metrics and suggested scores) when available, evaluations and coaching tasks. Use `item.revision` as `expectedRevision` when you change the review. The acting member needs a quality role. Managers see every review; reviewers see the reviews assigned to them; agents see only their own submitted reviews.\n\n**Scope:** `quality.read` (read quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Quality review ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The review.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QmsDetail"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /qms/cases/{id}"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/cases/{id}/manifest": {
      "get": {
        "operationId": "getQualityReviewRecordingManifest",
        "summary": "Get a review's recording manifest",
        "description": "Lists the recordings of the reviewed call, grouped into recording sets, with each artifact's `id`, type, format, length and whether it is playable. Use a playable artifact's `id` with **Download a review recording**. The acting member needs recording access. Returns `503` when recording playback is unavailable.\n\n**Scope:** `quality.read` (read quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Quality review ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The recording manifest. Its fields are snake_case, as the call recorder writes them.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordingManifest"
                },
                "example": {
                  "schema_version": 1,
                  "call_id": "6f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f",
                  "call_state": "COMPLETED",
                  "generated_at": "2026-12-01T09:46:00.000Z",
                  "sets": [
                    {
                      "id": "set-1",
                      "attempt_id": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                      "state": "ACKNOWLEDGED",
                      "attribution": "CONFIRMED_TWO_PARTY",
                      "warnings": [],
                      "artifacts": [
                        {
                          "id": "rec_01HZX4",
                          "type": "STEREO_MASTER",
                          "state": "ACKNOWLEDGED",
                          "format": "wav",
                          "sample_rate": 8000,
                          "channels": 2,
                          "checksum": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
                          "byte_length": 5888044,
                          "start_offset_ms": 0,
                          "playable": true,
                          "channel_roles": [
                            "CUSTOMER",
                            "AGENT"
                          ]
                        }
                      ],
                      "segments": []
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "GET /qms/cases/{id}/manifest"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/cases/{id}/recordings/{recordingId}/content": {
      "get": {
        "operationId": "downloadQualityReviewRecording",
        "summary": "Download a review recording",
        "description": "Streams the audio of a recording listed in the review's manifest. Send a single `Range: bytes=…` header to resume a download or seek; the response is then `206 Partial Content`. The acting member needs recording access, and each download is recorded in the audit log.\n\n**Scope:** `quality.read` (read quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Quality review ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "recordingId",
            "in": "path",
            "required": true,
            "description": "Recording ID.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
            }
          },
          {
            "name": "Range",
            "in": "header",
            "required": false,
            "description": "One byte range, for example `bytes=0-1048575`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The whole recording.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Accept-Ranges": {
                "description": "Always `bytes`.",
                "schema": {
                  "type": "string"
                }
              },
              "Content-Length": {
                "description": "Size of the audio in bytes.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "audio/wav"
                }
              }
            }
          },
          "206": {
            "description": "The requested byte range.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Content-Range": {
                "description": "The range returned, for example `bytes 0-1048575/5242880`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "audio/wav"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "RECORDING_NOT_FOUND",
            "when": "The recording does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "GET /qms/cases/{id}/recordings/{recordingId}/content"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/scorecards": {
      "post": {
        "operationId": "publishQualityScorecard",
        "summary": "Publish a scorecard",
        "description": "Publishes a new scorecard version for a campaign. Each parameter has a unique `id`, the instruction reviewers (and automatic scoring) follow, the evidence `source` and a maximum score. A failed `critical` parameter flags the whole review as a critical failure.\n\nScorecards are immutable: publishing again creates the next version. A new version is not used until you point the campaign at it with **Save quality settings for a campaign** (its `id` is the settings' `scorecardId`). Needs a quality manager with scorecard management access.\n\n`requestId` is a UUID you generate per submission. Retrying with the same `requestId` and the same body returns the current review without saving twice; the same `requestId` with a different body returns `409`.\n\n**Scope:** `quality.write` (change quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QmsScorecardInput"
              },
              "example": {
                "requestId": "c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f",
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "title": "Solar sales call quality",
                "parameters": [
                  {
                    "id": "greeting",
                    "name": "Greeting and introduction",
                    "instruction": "Greets; names self and company.",
                    "source": "TRANSCRIPT",
                    "maxScore": 10
                  },
                  {
                    "id": "recording_disclosure",
                    "name": "Recording disclosure",
                    "instruction": "Says that the call is recorded.",
                    "source": "TRANSCRIPT",
                    "maxScore": 20,
                    "critical": true
                  },
                  {
                    "id": "needs_discovery",
                    "name": "Needs discovery",
                    "instruction": "Asks bill, roof type and area.",
                    "source": "TRANSCRIPT",
                    "maxScore": 30
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The published scorecard.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QmsCard"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /qms/scorecards"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/settings": {
      "put": {
        "operationId": "saveQualitySettings",
        "summary": "Save quality settings for a campaign",
        "description": "Turns quality review on or off for a campaign, picks the scorecard version (which must belong to the same campaign, otherwise `400`), whether new calls are analysed automatically, and the default reviewer.\n\nSend the settings' current `revision` (0 the first time; see `settings` in **List quality reviews**) as `expectedRevision`; a stale revision returns `409`. Enabling review returns `503` while quality evidence encryption is not configured.\n\nThe response is `{ campaignId, revision }` with the new revision.\n\n**Scope:** `quality.write` (change quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QmsSettingsInput"
              },
              "example": {
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "expectedRevision": 0,
                "enabled": true,
                "autoAnalyze": true,
                "scorecardId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
                "defaultReviewerId": "d4c3b2a1-f6e5-4d7c-9b8a-1f2e3d4c5b6a"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The settings were saved: `{ campaignId, revision }`.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QualitySettingsSaved"
                },
                "example": {
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "revision": 1
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "PUT /qms/settings"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/cases/{id}/assignment": {
      "put": {
        "operationId": "assignQualityReview",
        "summary": "Assign a quality review",
        "description": "Assigns the review to a reviewer (a member who can evaluate), or unassigns it with `reviewerId: null`. Needs a quality manager. Send the review's current `revision` (from **Get a quality review**) as `expectedRevision`. If the review changed in the meantime the request fails with `409`: read it again and retry.\n\n**Scope:** `quality.write` (change quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Quality review ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QmsAssignmentInput"
              },
              "example": {
                "reviewerId": "d4c3b2a1-f6e5-4d7c-9b8a-1f2e3d4c5b6a",
                "expectedRevision": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The quality review after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QmsDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /qms/cases/{id}/assignment"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/cases/{id}/analysis": {
      "post": {
        "operationId": "requestQualityReviewAnalysis",
        "summary": "Request automatic analysis",
        "description": "Queues automatic analysis of the call: transcription, talk-time metrics and suggested scores against the scorecard. Analysis runs in the background; poll **Get a quality review** until `item.analysisStatus` is `COMPLETED` or `FAILED`.\n\nIf analysis is already queued, running or completed, nothing is queued again and the current state is returned. Needs a reviewer or manager with recording access.\n\nThe response is `{ id, state }`. Returns `503` while quality evidence encryption is not configured for the workspace.\n\n**Scope:** `quality.write` (change quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Quality review ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Analysis is queued or already done: `{ id, state }`.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QualityAnalysisState"
                },
                "example": {
                  "id": "b7c8d9e0-f1a2-4b3c-8d4e-5f6a7b8c9d0e",
                  "state": "QUEUED"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.write",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "POST /qms/cases/{id}/analysis"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/cases/{id}/evaluations": {
      "post": {
        "operationId": "submitQualityEvaluation",
        "summary": "Submit an evaluation",
        "description": "Scores the call against the review's scorecard, one entry per parameter. With `submit: false` the evaluation is saved as a draft and the review stays in review; with `submit: true` the review becomes `REVIEWED`, its score and critical-failure flag are set, and every score needs a `reason`.\n\nEvidence (`evidenceSegmentIds`, `evidenceStartMs`, `evidenceEndMs`) must point into the call's transcript and duration. Scores above a parameter's `maxScore` or unknown parameters return `400`.\n\nSend the review's current `revision` (from **Get a quality review**) as `expectedRevision`. If the review changed in the meantime the request fails with `409`: read it again and retry.\n\n`requestId` is a UUID you generate per submission. Retrying with the same `requestId` and the same body returns the current review without saving twice; the same `requestId` with a different body returns `409`. Returns `503` while quality evidence encryption is not configured for the workspace.\n\n**Scope:** `quality.write` (change quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Quality review ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QmsEvaluationInput"
              },
              "example": {
                "requestId": "c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f",
                "expectedRevision": 2,
                "submit": true,
                "scores": [
                  {
                    "parameterId": "greeting",
                    "result": "PASS",
                    "score": 10,
                    "reason": "Greeted by name; named the company.",
                    "evidenceSegmentIds": [
                      "seg_0001"
                    ],
                    "evidenceStartMs": 0,
                    "evidenceEndMs": 6200
                  },
                  {
                    "parameterId": "recording_disclosure",
                    "result": "FAIL",
                    "score": 0,
                    "reason": "The recording disclosure was not given.",
                    "evidenceSegmentIds": [],
                    "evidenceStartMs": null,
                    "evidenceEndMs": null
                  },
                  {
                    "parameterId": "needs_discovery",
                    "result": "PASS",
                    "score": 25,
                    "reason": "Asked bill and roof type, not roof area.",
                    "evidenceSegmentIds": [
                      "seg_0007",
                      "seg_0009"
                    ],
                    "evidenceStartMs": 41000,
                    "evidenceEndMs": 88500
                  }
                ],
                "notes": "Coach on the recording disclosure."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The quality review after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QmsDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "POST /qms/cases/{id}/evaluations"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/cases/{id}/coaching": {
      "post": {
        "operationId": "createQualityCoachingTask",
        "summary": "Create a coaching task",
        "description": "Creates a coaching task for the agent who handled the call, optionally pointing at an interval of the recording (`startMs` and `endMs` both set, or both `null`). `dueAt` must be in the future. Needs a quality manager. Calls without an attributed agent return `409`.\n\n`requestId` is a UUID you generate per submission. Retrying with the same `requestId` and the same body returns the current review without saving twice; the same `requestId` with a different body returns `409`. Returns `503` while quality evidence encryption is not configured for the workspace.\n\n**Scope:** `quality.write` (change quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Quality review ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QmsCoachingInput"
              },
              "example": {
                "requestId": "c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f",
                "title": "Give the recording disclosure",
                "note": "Say the call is recorded before anything else.",
                "dueAt": "2026-12-08T12:30:00.000Z",
                "startMs": 0,
                "endMs": 15000
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The review with the new task.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QmsDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "POST /qms/cases/{id}/coaching"
      }
    },
    "/v1/tenants/{tenantSlug}/qms/cases/{id}/coaching/{taskId}": {
      "put": {
        "operationId": "updateQualityCoachingTask",
        "summary": "Acknowledge or complete a coaching task",
        "description": "Moves a coaching task forward: the coached agent acknowledges an `OPEN` task (`ACKNOWLEDGED`), then a quality manager completes it (`COMPLETED`). Send the task's current `revision` as `expectedRevision`; a stale revision, or a task not in the expected state, returns `409`.\n\n**Scope:** `quality.write` (change quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Quality review ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "Coaching task ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QmsCoachingTransitionInput"
              },
              "example": {
                "state": "ACKNOWLEDGED",
                "expectedRevision": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The quality review after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QmsDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /qms/cases/{id}/coaching/{taskId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/sales/{campaignId}": {
      "get": {
        "operationId": "getSalesQuality",
        "summary": "Get sales quality for a campaign",
        "description": "Returns the campaign's sales funnel from human calling (calls, contacted, qualified, appointment and converted leads), the sales policy that maps call dispositions to funnel stages, and open escalations for overdue follow-ups. Needs calling management permission.\n\n**Scope:** `quality.read` (read quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sales quality.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesOverview"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /lms/sales/{campaignId}"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/sales/policy": {
      "put": {
        "operationId": "saveSalesPolicy",
        "summary": "Save a campaign's sales policy",
        "description": "Maps the campaign's active call dispositions to funnel stages (`QUALIFIED`, `APPOINTMENT`, `CONVERTED`), each disposition at most once, and sets when an open follow-up counts as overdue and who receives the escalation (an active member with calling management permission, or `null`).\n\nInactive or unknown dispositions, or an ineligible owner, return `400`. Send the policy's current `revision` (`policy.expectedRevision` from **Get sales quality for a campaign**, 0 the first time) as `expectedRevision`; a stale revision returns `409`. Campaigns without calling configured return `404`.\n\n**Scope:** `quality.write` (change quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SalesPolicyInputInput"
              },
              "example": {
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "expectedRevision": 1,
                "overdueMinutes": 120,
                "escalationOwnerId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                "stages": [
                  {
                    "dispositionKey": "INTERESTED",
                    "stage": "QUALIFIED"
                  },
                  {
                    "dispositionKey": "SITE_VISIT_BOOKED",
                    "stage": "APPOINTMENT"
                  },
                  {
                    "dispositionKey": "ORDER_CONFIRMED",
                    "stage": "CONVERTED"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sales quality after the change.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesOverview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /lms/sales/policy"
      }
    },
    "/v1/tenants/{tenantSlug}/lms/sales/escalations/{id}/acknowledge": {
      "post": {
        "operationId": "acknowledgeSalesEscalation",
        "summary": "Acknowledge a follow-up escalation",
        "description": "Marks an open escalation for an overdue follow-up as acknowledged. Send the escalation's current `revision` as `expectedRevision`; a stale revision, or an escalation that is no longer open, returns `409`. The response is `{ id }`.\n\n**Scope:** `quality.write` (change quality reviews).",
        "tags": [
          "Quality"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Escalation ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SalesEscalationAcknowledgeInput"
              },
              "example": {
                "expectedRevision": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The escalation was acknowledged: `{ id }`.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesEscalationAcknowledged"
                },
                "example": {
                  "id": "c8d9e0f1-a2b3-4c4d-9e5f-6a7b8c9d0e1f"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "quality.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "quality.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `quality.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /lms/sales/escalations/{id}/acknowledge"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calling-profiles": {
      "get": {
        "operationId": "listVoicebotCallingProfiles",
        "summary": "List calling profiles",
        "description": "Lists the calling profiles assigned to the workspace, with their caller IDs, concurrency limit and health. A Voicebot configuration names one profile and one of its caller IDs.\n\n**Scope:** `voicebot.read` (read voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "Every calling profile of the workspace, in one response.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallingProfilePageResponse"
                },
                "example": {
                  "items": [
                    {
                      "id": "d5e6f7a8-b9c0-4d1e-8f2a-3b4c5d6e7f80",
                      "displayName": "Pune outbound pool",
                      "status": "ACTIVE",
                      "healthStatus": "HEALTHY",
                      "concurrencyLimit": 20,
                      "callerIds": [
                        {
                          "id": "e6f7a8b9-c0d1-4e2f-9a3b-4c5d6e7f8091",
                          "displayName": "Pune office line",
                          "phoneNumber": "+918040001234",
                          "status": "ACTIVE"
                        }
                      ]
                    }
                  ],
                  "nextCursor": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /voicebot/calling-profiles"
      }
    },
    "/v1/tenants/{tenantSlug}/campaigns/{campaignId}/available-voicebots": {
      "get": {
        "operationId": "listAvailableVoicebots",
        "summary": "List Voicebots available to a campaign",
        "description": "Lists the active Voicebot versions built for the campaign's process. Use a version's `versionId` as `voicebotProfileVersionId`, and its `language` as the configuration's `language`.\n\n**Scope:** `voicebot.read` (read voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Every available Voicebot version, in one response.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessVoicebotPageResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /campaigns/{campaignId}/available-voicebots"
      }
    },
    "/v1/tenants/{tenantSlug}/campaigns/{campaignId}/available-consent-policies": {
      "get": {
        "operationId": "listAvailableConsentPolicies",
        "summary": "List recording consent policies",
        "description": "Lists the active recording consent policy versions for a language. Recording Voicebot calls requires one: set `recordingEnabled: true` and its version ID as `recordingConsentPolicyVersionId`; its language must match the configuration's.\n\n**Scope:** `voicebot.read` (read voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": true,
            "description": "Language, as an IETF tag such as `en-IN` or `hi-IN`.",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 35
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Every active consent policy version, in one response.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordingConsentPolicyVersionPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /campaigns/{campaignId}/available-consent-policies"
      }
    },
    "/v1/tenants/{tenantSlug}/campaigns/{campaignId}/voicebot-configuration": {
      "get": {
        "operationId": "getVoicebotConfiguration",
        "summary": "Get a campaign's Voicebot configuration",
        "description": "Returns the current draft and the latest published version number (`publishedVersion`, `null` if never published). Returns `404` until a draft has been saved. Voicebot settings follow a draft and publish lifecycle: **Save the Voicebot configuration** edits a draft, **Publish the Voicebot configuration** turns the draft into a new immutable version, and only published versions are used for calls.\n\n**Scope:** `voicebot.read` (read voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The campaign's Voicebot configuration draft, with the latest published version.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedVoicebotCampaignConfigurationResponse"
                },
                "example": {
                  "callingProfileId": "d5e6f7a8-b9c0-4d1e-8f2a-3b4c5d6e7f80",
                  "callerIdId": "e6f7a8b9-c0d1-4e2f-9a3b-4c5d6e7f8091",
                  "callingWindows": [
                    {
                      "days": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "startsAt": "10:00",
                      "endsAt": "13:00"
                    },
                    {
                      "days": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "startsAt": "15:00",
                      "endsAt": "19:00"
                    },
                    {
                      "days": [
                        6
                      ],
                      "startsAt": "10:00",
                      "endsAt": "14:00"
                    }
                  ],
                  "language": "hi-IN",
                  "maxAttempts": 3,
                  "outcomeMappings": {
                    "CONNECTED_INTERESTED": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                    "CALLBACK_REQUESTED": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                    "DO_NOT_CALL": null
                  },
                  "recordingConsentPolicyVersionId": "f7a8b9c0-d1e2-4f3a-8b4c-5d6e7f8091a2",
                  "recordingEnabled": true,
                  "retryBotFailureAfterAnswer": false,
                  "retryDelaysMinutes": [
                    60,
                    240
                  ],
                  "timezone": "Asia/Kolkata",
                  "voicebotProfileVersionId": "c9d0e1f2-a3b4-4c5d-8e6f-7a8b9c0d1e2f",
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "publishedVersion": 2,
                  "revision": 3,
                  "updatedAt": "2026-12-01T10:05:00.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /campaigns/{campaignId}/voicebot-configuration"
      },
      "put": {
        "operationId": "saveVoicebotConfiguration",
        "summary": "Save the Voicebot configuration",
        "description": "Creates or replaces the campaign's Voicebot draft. Voicebot settings follow a draft and publish lifecycle: **Save the Voicebot configuration** edits a draft, **Publish the Voicebot configuration** turns the draft into a new immutable version, and only published versions are used for calls.\n\nRules checked on save and again on publish (`409` when they fail): the campaign's `VOICEBOT` module is enabled; the calling profile and caller ID are ready; the Voicebot version belongs to the campaign's process and speaks `language`; with `recordingEnabled`, the consent policy version is active and in the same language; outcome mappings point at active stages of the process.\n\nCalling windows are local to `timezone`, use `days` 0 (Sunday) to 6 (Saturday) and may not overlap on the same day. `retryDelaysMinutes` has exactly `maxAttempts - 1` entries.\n\nSend the draft's current `revision` as `expectedRevision` (omit it, or send 0, for the first save); a stale revision returns `409`.\n\n**Scope:** `voicebot.write` (run voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertManagedVoicebotCampaignDraftRequest"
              },
              "example": {
                "callingProfileId": "d5e6f7a8-b9c0-4d1e-8f2a-3b4c5d6e7f80",
                "callerIdId": "e6f7a8b9-c0d1-4e2f-9a3b-4c5d6e7f8091",
                "callingWindows": [
                  {
                    "days": [
                      1,
                      2,
                      3,
                      4,
                      5
                    ],
                    "startsAt": "10:00",
                    "endsAt": "13:00"
                  },
                  {
                    "days": [
                      1,
                      2,
                      3,
                      4,
                      5
                    ],
                    "startsAt": "15:00",
                    "endsAt": "19:00"
                  },
                  {
                    "days": [
                      6
                    ],
                    "startsAt": "10:00",
                    "endsAt": "14:00"
                  }
                ],
                "language": "hi-IN",
                "maxAttempts": 3,
                "outcomeMappings": {
                  "CONNECTED_INTERESTED": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                  "CALLBACK_REQUESTED": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                  "DO_NOT_CALL": null
                },
                "recordingConsentPolicyVersionId": "f7a8b9c0-d1e2-4f3a-8b4c-5d6e7f8091a2",
                "recordingEnabled": true,
                "retryBotFailureAfterAnswer": false,
                "retryDelaysMinutes": [
                  60,
                  240
                ],
                "timezone": "Asia/Kolkata",
                "voicebotProfileVersionId": "c9d0e1f2-a3b4-4c5d-8e6f-7a8b9c0d1e2f",
                "expectedRevision": 2
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved draft.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedVoicebotCampaignConfigurationResponse"
                },
                "example": {
                  "callingProfileId": "d5e6f7a8-b9c0-4d1e-8f2a-3b4c5d6e7f80",
                  "callerIdId": "e6f7a8b9-c0d1-4e2f-9a3b-4c5d6e7f8091",
                  "callingWindows": [
                    {
                      "days": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "startsAt": "10:00",
                      "endsAt": "13:00"
                    },
                    {
                      "days": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "startsAt": "15:00",
                      "endsAt": "19:00"
                    },
                    {
                      "days": [
                        6
                      ],
                      "startsAt": "10:00",
                      "endsAt": "14:00"
                    }
                  ],
                  "language": "hi-IN",
                  "maxAttempts": 3,
                  "outcomeMappings": {
                    "CONNECTED_INTERESTED": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                    "CALLBACK_REQUESTED": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                    "DO_NOT_CALL": null
                  },
                  "recordingConsentPolicyVersionId": "f7a8b9c0-d1e2-4f3a-8b4c-5d6e7f8091a2",
                  "recordingEnabled": true,
                  "retryBotFailureAfterAnswer": false,
                  "retryDelaysMinutes": [
                    60,
                    240
                  ],
                  "timezone": "Asia/Kolkata",
                  "voicebotProfileVersionId": "c9d0e1f2-a3b4-4c5d-8e6f-7a8b9c0d1e2f",
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "publishedVersion": 2,
                  "revision": 3,
                  "updatedAt": "2026-12-01T10:05:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "VOICEBOT_CONFIGURATION_STALE",
            "when": "The draft changed after you read it; read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PUT /campaigns/{campaignId}/voicebot-configuration"
      }
    },
    "/v1/tenants/{tenantSlug}/campaigns/{campaignId}/voicebot-configuration/publish": {
      "post": {
        "operationId": "publishVoicebotConfiguration",
        "summary": "Publish the Voicebot configuration",
        "description": "Publishes the current draft as the campaign's next configuration version. New call batches use it; requests already queued keep the version they were created with. Send the draft's `revision` as `expectedRevision` so you publish exactly what you reviewed; a stale revision, or a draft that no longer passes the save rules, returns `409`.\n\n**Scope:** `voicebot.write` (run voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishVoicebotCampaignRequest"
              },
              "example": {
                "expectedRevision": 3
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The configuration with the new `publishedVersion`.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedVoicebotCampaignConfigurationResponse"
                },
                "example": {
                  "callingProfileId": "d5e6f7a8-b9c0-4d1e-8f2a-3b4c5d6e7f80",
                  "callerIdId": "e6f7a8b9-c0d1-4e2f-9a3b-4c5d6e7f8091",
                  "callingWindows": [
                    {
                      "days": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "startsAt": "10:00",
                      "endsAt": "13:00"
                    },
                    {
                      "days": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "startsAt": "15:00",
                      "endsAt": "19:00"
                    },
                    {
                      "days": [
                        6
                      ],
                      "startsAt": "10:00",
                      "endsAt": "14:00"
                    }
                  ],
                  "language": "hi-IN",
                  "maxAttempts": 3,
                  "outcomeMappings": {
                    "CONNECTED_INTERESTED": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                    "CALLBACK_REQUESTED": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                    "DO_NOT_CALL": null
                  },
                  "recordingConsentPolicyVersionId": "f7a8b9c0-d1e2-4f3a-8b4c-5d6e7f8091a2",
                  "recordingEnabled": true,
                  "retryBotFailureAfterAnswer": false,
                  "retryDelaysMinutes": [
                    60,
                    240
                  ],
                  "timezone": "Asia/Kolkata",
                  "voicebotProfileVersionId": "c9d0e1f2-a3b4-4c5d-8e6f-7a8b9c0d1e2f",
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "publishedVersion": 2,
                  "revision": 3,
                  "updatedAt": "2026-12-01T10:05:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CAMPAIGN_NOT_FOUND",
            "when": "The campaign does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "VOICEBOT_CONFIGURATION_STALE",
            "when": "The draft changed after you read it; read it again and resend."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /campaigns/{campaignId}/voicebot-configuration/publish"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calls/batches/preview": {
      "post": {
        "operationId": "previewVoicebotCallBatch",
        "summary": "Preview a Voicebot call batch",
        "description": "Checks which leads a batch would call, without creating anything. Leads are excluded when they are not in the campaign, the campaign has no ready published Voicebot configuration, the lead has no valid phone number, the number is suppressed, or the lead already has an active call request. Preview before **Submit a Voicebot call batch** and show the exclusions to the user.\n\n**Scope:** `voicebot.write` (run voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCallBatchRequest"
              },
              "example": {
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "leadIds": [
                  "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "6d7e8f90-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
                  "7e8f9a0b-2c3d-4e5f-9a6b-7c8d9e0f1a2b"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Eligible leads and exclusions.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallBatchPreviewResponse"
                },
                "example": {
                  "eligibleLeadIds": [
                    "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "6d7e8f90-1a2b-4c3d-8e4f-5a6b7c8d9e0f"
                  ],
                  "exclusions": [
                    {
                      "leadId": "7e8f9a0b-2c3d-4e5f-9a6b-7c8d9e0f1a2b",
                      "reason": "ACTIVE_REQUEST_EXISTS"
                    }
                  ],
                  "requestedCount": 3
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /voicebot/calls/batches/preview"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calls/batches": {
      "post": {
        "operationId": "createVoicebotCallBatch",
        "summary": "Submit a Voicebot call batch",
        "description": "Queues Voicebot calls for up to 500 unique leads of one campaign, using the campaign's latest published Voicebot configuration. Eligibility is checked again at submission (see **Preview a Voicebot call batch**); ineligible leads are listed in `exclusions` and the rest get one call request each, dialled within the configuration's calling windows and retried per its retry rules.\n\nThe batch is accepted even when every lead is excluded (`acceptedCount: 0`). Resubmitting the same leads does not call them twice: leads with an active request are excluded. An unknown campaign returns `404`; if eligibility changes while the batch is being created the request fails with `409` and can be retried.\n\n**Scope:** `voicebot.write` (run voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCallBatchRequest"
              },
              "example": {
                "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                "leadIds": [
                  "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                  "6d7e8f90-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
                  "7e8f9a0b-2c3d-4e5f-9a6b-7c8d9e0f1a2b"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The batch.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Location": {
                "description": "URL of the new batch.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallBatchResponse"
                },
                "example": {
                  "acceptedCount": 2,
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "createdBy": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                  "exclusions": [
                    {
                      "leadId": "7e8f9a0b-2c3d-4e5f-9a6b-7c8d9e0f1a2b",
                      "reason": "ACTIVE_REQUEST_EXISTS"
                    }
                  ],
                  "id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
                  "requestedCount": 3,
                  "status": "CREATED",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "CALL_BATCH_ELIGIBILITY_STALE",
            "when": "Lead eligibility changed since the preview; preview again."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /voicebot/calls/batches"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calls/batches/{batchId}": {
      "get": {
        "operationId": "getVoicebotCallBatch",
        "summary": "Get a Voicebot call batch",
        "description": "**Scope:** `voicebot.read` (read voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "description": "Batch ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The batch.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallBatchResponse"
                },
                "example": {
                  "acceptedCount": 2,
                  "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "createdBy": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                  "exclusions": [
                    {
                      "leadId": "7e8f9a0b-2c3d-4e5f-9a6b-7c8d9e0f1a2b",
                      "reason": "ACTIVE_REQUEST_EXISTS"
                    }
                  ],
                  "id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
                  "requestedCount": 3,
                  "status": "CREATED",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "BATCH_NOT_FOUND",
            "when": "The batch does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /voicebot/calls/batches/{batchId}"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calls/requests": {
      "get": {
        "operationId": "listVoicebotCallRequests",
        "summary": "List Voicebot call requests",
        "description": "Lists call requests (one per lead per batch), optionally filtered by campaign and status. A request moves from `QUEUED` through `IN_PROGRESS` to a final status such as `COMPLETED`, `EXHAUSTED` (attempts used up), `SUPPRESSED`, `CANCELLED` or `FAILED`. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `voicebot.read` (read voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "description": "ID of the campaign.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "`nextCursor` from the previous page.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the voicebot call request.",
            "schema": {
              "type": "string",
              "enum": [
                "QUEUED",
                "WAITING_FOR_WINDOW",
                "WAITING_FOR_CAPACITY",
                "IN_PROGRESS",
                "COMPLETED",
                "EXHAUSTED",
                "SUPPRESSED",
                "CANCELLED",
                "FAILED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of call requests.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallRequestPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /voicebot/calls/requests"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calls/requests/{requestId}/cancel": {
      "post": {
        "operationId": "cancelVoicebotCallRequest",
        "summary": "Cancel a Voicebot call request",
        "description": "Stops further attempts for a call request and records why. A call already in progress is asked to end. Requests that have already finished cannot be cancelled (`409`).\n\n**Scope:** `voicebot.write` (run voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "description": "Call request ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelCallRequest"
              },
              "example": {
                "reason": "Customer asked not to be called by the Voicebot."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The cancelled request.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallRequestResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /voicebot/calls/requests/{requestId}/cancel"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calls/attempts/{attemptId}": {
      "get": {
        "operationId": "getVoicebotCallAttempt",
        "summary": "Get a Voicebot call attempt",
        "description": "Returns one dial attempt: telephony timings, talk and billable seconds, the Voicebot outcome, the event timeline, recordings and transcripts (`media`) and any open exceptions. The destination number is masked.\n\n**Scope:** `voicebot.read` (read voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "attemptId",
            "in": "path",
            "required": true,
            "description": "Call attempt ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The attempt.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallAttemptResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CALL_ATTEMPT_NOT_FOUND",
            "when": "The call attempt does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /voicebot/calls/attempts/{attemptId}"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calls/attempts/{attemptId}/reconcile": {
      "post": {
        "operationId": "reconcileVoicebotCallAttempt",
        "summary": "Reconcile a Voicebot call attempt",
        "description": "Asks LMS to re-check an attempt's final state with the telephony provider and the Voicebot, for example when an attempt is stuck or its outcome is missing. Reconciliation runs in the background; read the attempt again later.\n\n**Scope:** `voicebot.write` (run voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "attemptId",
            "in": "path",
            "required": true,
            "description": "Call attempt ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Reconciliation was queued.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconcileCallAttemptResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.write",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "CALL_ATTEMPT_NOT_FOUND",
            "when": "The call attempt does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /voicebot/calls/attempts/{attemptId}/reconcile"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calls/exceptions": {
      "get": {
        "operationId": "listVoicebotCallExceptions",
        "summary": "List Voicebot call exceptions",
        "description": "Lists operational problems detected on Voicebot calls (missing outcomes, conflicting callbacks, stuck reservations, recording or transcript issues), most recently observed first. Returns up to `limit` items; `nextCursor` is always `null`, so narrow with `category` and `status` instead of paging.\n\n**Scope:** `voicebot.read` (read voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Category, from the values below.",
            "schema": {
              "type": "string",
              "enum": [
                "CALLBACK_AUTH",
                "CALLBACK_CONFLICT",
                "OUTCOME_CONFLICT",
                "MISSING_PROVIDER_END",
                "MISSING_VOICEBOT_OUTCOME",
                "STUCK_RESERVATION",
                "RECONCILIATION",
                "MEDIA_RECORDING",
                "MEDIA_INGESTION",
                "MEDIA_RETENTION",
                "DLQ"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the voicebot call exception.",
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "RESOLVED",
                "IGNORED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Up to `limit` exceptions, in one response.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallOperationsExceptionPage"
                },
                "example": {
                  "items": [
                    {
                      "id": "e0f1a2b3-c4d5-4e6f-9a7b-8c9d0e1f2a3b",
                      "attemptId": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d",
                      "category": "MISSING_PROVIDER_END",
                      "code": "PROVIDER_END_MISSING",
                      "firstObservedAt": "2026-12-01T09:50:00.000Z",
                      "lastObservedAt": "2026-12-01T10:20:00.000Z",
                      "occurrenceCount": 3,
                      "safeDetail": {
                        "provider": "plivo",
                        "waitedMinutes": 30
                      },
                      "status": "OPEN"
                    }
                  ],
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /voicebot/calls/exceptions"
      }
    },
    "/v1/tenants/{tenantSlug}/voicebot/calls/usage": {
      "get": {
        "operationId": "getVoicebotUsage",
        "summary": "Get Voicebot usage",
        "description": "Summarises Voicebot calling between two dates (inclusive, at most 90 days apart): attempts, connected calls, outcomes, talk and billable seconds. Filter by campaign, calling profile, caller number, Voicebot version or outcome. Returns `503` while usage reporting is unavailable.\n\n**Scope:** `voicebot.read` (read voicebot).",
        "tags": [
          "Voicebot"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "botVersionId",
            "in": "query",
            "required": false,
            "description": "ID of the bot version.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "callingProfileId",
            "in": "query",
            "required": false,
            "description": "ID of the calling profile.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "description": "ID of the campaign.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": true,
            "description": "Last day of the period (`YYYY-MM-DD`), inclusive.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "numberId",
            "in": "query",
            "required": false,
            "description": "ID of the number.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "description": "Outcome, from the values below.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": true,
            "description": "First day of the period (`YYYY-MM-DD`).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Usage summary.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantVoicebotUsageSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "apiKey": [
              "voicebot.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "voicebot.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `voicebot.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          },
          {
            "status": 503,
            "code": null,
            "when": "A service this operation depends on is temporarily unavailable; retry with backoff."
          }
        ],
        "x-partner-operation": "GET /voicebot/calls/usage"
      }
    },
    "/v1/tenants/{tenantSlug}/teams": {
      "get": {
        "operationId": "listTeams",
        "summary": "List teams",
        "description": "Returns every team with its active member count, optionally only active or archived teams. Not paged; for large workspaces, or to search by name, use **List team summaries**.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the team.",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "All matching teams.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TeamSummaryResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams"
      },
      "post": {
        "operationId": "createTeam",
        "summary": "Create a team",
        "description": "Creates an active team. Team names are unique in the workspace (`409` otherwise).\n\n**Scope:** `team.write` (change teams).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTeamRequest"
              },
              "example": {
                "name": "Pune Inside Sales",
                "description": "Handles inbound solar enquiries for Pune."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new team.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Location": {
                "description": "URL of the new team.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamResponse"
                },
                "example": {
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "description": "Handles inbound solar enquiries for Pune.",
                  "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "name": "Pune Inside Sales",
                  "status": "ACTIVE",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 409,
            "code": "TEAM_NAME_CONFLICT",
            "when": "Another team already has this name."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /teams"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/summaries": {
      "get": {
        "operationId": "listTeamSummaries",
        "summary": "List team summaries",
        "description": "Searches teams by name and status, with member counts and the total number of matches. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Free-text search; matches names and other visible text, case-insensitively.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the team summary.",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of teams.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamSummaryPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/summaries"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/{teamId}": {
      "get": {
        "operationId": "getTeam",
        "summary": "Get a team",
        "description": "**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "teamId",
            "in": "path",
            "required": true,
            "description": "Team ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The team.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamResponse"
                },
                "example": {
                  "createdAt": "2026-12-01T10:00:00.000Z",
                  "description": "Handles inbound solar enquiries for Pune.",
                  "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "name": "Pune Inside Sales",
                  "status": "ACTIVE",
                  "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                  "updatedAt": "2026-12-01T10:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "TEAM_NOT_FOUND",
            "when": "The team does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/{teamId}"
      },
      "patch": {
        "operationId": "updateTeam",
        "summary": "Update a team",
        "description": "Renames a team or changes its description (`null` clears it). Send at least one field. Archived teams, and names already in use, return `409`.\n\n**Scope:** `team.write` (change teams).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "teamId",
            "in": "path",
            "required": true,
            "description": "Team ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTeamRequest"
              },
              "example": {
                "name": "Pune and PCMC Inside Sales"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated team.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "TEAM_NOT_FOUND",
            "when": "The team does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": "TEAM_NAME_CONFLICT",
            "when": "Another team already has this name."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "PATCH /teams/{teamId}"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/{teamId}/archive": {
      "post": {
        "operationId": "archiveTeam",
        "summary": "Archive a team",
        "description": "Archives a team. Archiving never cascades: if a published allocation ruleset references the team or leads are still assigned to it, the request fails with `409` (`TEAM_IN_USE`) and `error.details.conflicts` lists what to change first. Archiving an archived team succeeds without changes.\n\n**Scope:** `team.write` (change teams).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "teamId",
            "in": "path",
            "required": true,
            "description": "Team ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The archived team.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.write",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "TEAM_NOT_FOUND",
            "when": "The team does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /teams/{teamId}/archive"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/{teamId}/members": {
      "get": {
        "operationId": "listTeamMembers",
        "summary": "List a team's members",
        "description": "Returns all of the team's members, active and inactive, in one list. For long rosters use **List a team's active members** or **List a team's membership history**, which are paged.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "teamId",
            "in": "path",
            "required": true,
            "description": "Team ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The team's members.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TeamMemberResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "TEAM_NOT_FOUND",
            "when": "The team does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/{teamId}/members"
      },
      "post": {
        "operationId": "addTeamMember",
        "summary": "Add a team member",
        "description": "Adds an active workspace member to the team, or reactivates a former member. The team must be active; users outside the workspace and members who are already active return `409`.\n\n**Scope:** `team.write` (change teams).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "teamId",
            "in": "path",
            "required": true,
            "description": "Team ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddTeamMemberRequest"
              },
              "example": {
                "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The membership.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMemberResponse"
                },
                "example": {
                  "createdAt": "2026-12-01T10:05:00.000Z",
                  "displayName": "Rohan Kulkarni",
                  "status": "ACTIVE",
                  "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "updatedAt": "2026-12-01T10:05:00.000Z",
                  "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.write",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "TEAM_NOT_FOUND",
            "when": "The team does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /teams/{teamId}/members"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/{teamId}/active-members": {
      "get": {
        "operationId": "listActiveTeamMembers",
        "summary": "List a team's active members",
        "description": "Lists the team's active members, sorted by name: the people leads can be assigned to in this team. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "teamId",
            "in": "path",
            "required": true,
            "description": "Team ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of active members.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMemberPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "TEAM_NOT_FOUND",
            "when": "The team does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/{teamId}/active-members"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/{teamId}/member-history": {
      "get": {
        "operationId": "listTeamMemberHistory",
        "summary": "List a team's membership history",
        "description": "Lists everyone who has been a member of the team, active and inactive. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "teamId",
            "in": "path",
            "required": true,
            "description": "Team ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of members.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMemberPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "TEAM_NOT_FOUND",
            "when": "The team does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/{teamId}/member-history"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/{teamId}/available-members": {
      "get": {
        "operationId": "listAvailableTeamMembers",
        "summary": "List members who can join a team",
        "description": "Lists active workspace members who are not active members of this team, sorted by name. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "teamId",
            "in": "path",
            "required": true,
            "description": "Team ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of members.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamDirectoryPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "TEAM_NOT_FOUND",
            "when": "The team does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/{teamId}/available-members"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/{teamId}/members/{userId}/deactivate": {
      "post": {
        "operationId": "deactivateTeamMember",
        "summary": "Remove a team member",
        "description": "Deactivates a membership. The record is kept, so assignment history still resolves. If a published allocation ruleset pins the member as a fixed agent, or the member still owns leads in this team, the request fails with `409` (`TEAM_MEMBER_IN_USE`) and `error.details.conflicts` lists what to change first. Deactivating an inactive member succeeds without changes.\n\n**Scope:** `team.write` (change teams).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "teamId",
            "in": "path",
            "required": true,
            "description": "Team ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "description": "User ID of the member.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The inactive membership.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMemberResponse"
                },
                "example": {
                  "createdAt": "2026-12-01T10:05:00.000Z",
                  "displayName": "Rohan Kulkarni",
                  "status": "INACTIVE",
                  "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                  "updatedAt": "2026-12-02T09:00:00.000Z",
                  "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.write"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.write",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.write` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "TEAM_NOT_FOUND",
            "when": "The team does not exist or the key cannot see it."
          },
          {
            "status": 404,
            "code": "MEMBER_NOT_FOUND",
            "when": "The member does not exist or the key cannot see it."
          },
          {
            "status": 409,
            "code": null,
            "when": "The change conflicts with the record's current state or a workflow rule; `error.code` names it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "POST /teams/{teamId}/members/{userId}/deactivate"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/directory": {
      "get": {
        "operationId": "listTeamDirectory",
        "summary": "List the member directory",
        "description": "Lists active workspace members by display name, for choosing people without handling contact details. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of members.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamDirectoryPageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/directory"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/lookup": {
      "get": {
        "operationId": "lookupTeams",
        "summary": "Look up teams by ID",
        "description": "Returns the teams with the given IDs, for example to label team IDs from lead records. Pass each ID as a repeated `teamId` query parameter (`?teamId=…&teamId=…`), 1 to 100 of them. Unknown IDs are omitted. For long lists use the `QUERY` form.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "The matching teams.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TeamSummaryResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/lookup"
      },
      "x-query": {
        "operationId": "queryTeams",
        "summary": "Look up teams by ID (query)",
        "description": "Same as **Look up teams by ID**, with up to 100 IDs in the body. Uses the HTTP `QUERY` method with a JSON body (safe and idempotent, like `GET`). Send `Content-Type: application/json`.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamLookupQuery"
              },
              "example": {
                "teamIds": [
                  "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The matching teams.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TeamSummaryResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableContent"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 415,
            "code": "QUERY_CONTENT_TYPE_UNSUPPORTED",
            "when": "The `QUERY` request has no `Content-Type: application/json` body."
          },
          {
            "status": 422,
            "code": "QUERY_VALIDATION_FAILED",
            "when": "The `QUERY` body is JSON but does not match the request fields."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "QUERY /teams/lookup"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/members": {
      "get": {
        "operationId": "lookupTeamMemberLabels",
        "summary": "Look up member names by user ID",
        "description": "Returns display names for the given user IDs, including former members, so historical owners still get a label. Pass each ID as a repeated `userId` query parameter (`?userId=…&userId=…`), 1 to 100 of them. Unknown IDs are omitted. For long lists use the `QUERY` form.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "Names of the matching members.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TeamMemberLabelResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/members"
      },
      "x-query": {
        "operationId": "queryTeamMemberLabels",
        "summary": "Look up member names by user ID (query)",
        "description": "Same as **Look up member names by user ID**, with up to 100 IDs in the body. Uses the HTTP `QUERY` method with a JSON body (safe and idempotent, like `GET`). Send `Content-Type: application/json`.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamMemberLookupQuery"
              },
              "example": {
                "userIds": [
                  "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Names of the matching members.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TeamMemberLabelResponse"
                  }
                },
                "example": [
                  {
                    "displayName": "Rohan Kulkarni",
                    "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableContent"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 415,
            "code": "QUERY_CONTENT_TYPE_UNSUPPORTED",
            "when": "The `QUERY` request has no `Content-Type: application/json` body."
          },
          {
            "status": 422,
            "code": "QUERY_VALIDATION_FAILED",
            "when": "The `QUERY` body is JSON but does not match the request fields."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "QUERY /teams/members"
      }
    },
    "/v1/tenants/{tenantSlug}/teams/membership-lookup": {
      "get": {
        "operationId": "lookupTeamMemberships",
        "summary": "Check team memberships",
        "description": "Returns the active memberships among the given team and user pairs, for example to check that a lead's owner still belongs to its team. Pass repeated `teamId` and `userId` query parameters; they are paired by position, so send the same number of each (1 to 100). Pairs without an active membership are omitted. For long lists use the `QUERY` form.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "Active memberships among the pairs.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TeamMemberResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /teams/membership-lookup"
      },
      "x-query": {
        "operationId": "queryTeamMemberships",
        "summary": "Check team memberships (query)",
        "description": "Same as **Check team memberships**, with up to 100 team and user pairs in the body. Uses the HTTP `QUERY` method with a JSON body (safe and idempotent, like `GET`). Send `Content-Type: application/json`.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamMembershipBulkLookupQuery"
              },
              "example": {
                "memberships": [
                  {
                    "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                    "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Active memberships among the pairs.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TeamMemberResponse"
                  }
                },
                "example": [
                  {
                    "createdAt": "2026-12-01T10:05:00.000Z",
                    "displayName": "Rohan Kulkarni",
                    "status": "ACTIVE",
                    "teamId": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                    "updatedAt": "2026-12-01T10:05:00.000Z",
                    "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableContent"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 415,
            "code": "QUERY_CONTENT_TYPE_UNSUPPORTED",
            "when": "The `QUERY` request has no `Content-Type: application/json` body."
          },
          {
            "status": 422,
            "code": "QUERY_VALIDATION_FAILED",
            "when": "The `QUERY` body is JSON but does not match the request fields."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "QUERY /teams/membership-lookup"
      }
    },
    "/v1/tenants/{tenantSlug}/members": {
      "get": {
        "operationId": "listMembers",
        "summary": "List workspace members",
        "description": "Lists workspace members and pending invitations with their roles and teams, optionally filtered by status or searched by name or email. The acting member needs permission to manage members. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Free-text search; matches names and other visible text, case-insensitively.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Current status of the member.",
            "schema": {
              "type": "string",
              "enum": [
                "INVITED",
                "ACTIVE",
                "SUSPENDED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of members.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantMemberPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /members"
      }
    },
    "/v1/tenants/{tenantSlug}/members/{recordId}": {
      "get": {
        "operationId": "getMember",
        "summary": "Get a workspace member",
        "description": "Returns one member or pending invitation by its `recordId` (from **List workspace members**). `recordKind` tells which it is. The acting member needs permission to manage members.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "recordId",
            "in": "path",
            "required": true,
            "description": "Member record ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The member.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantMember"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": null,
            "when": "The record does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /members/{recordId}"
      }
    },
    "/v1/tenants/{tenantSlug}/members/roles": {
      "get": {
        "operationId": "listMemberRoles",
        "summary": "List assignable roles",
        "description": "Lists the roles that can be given to workspace members. The acting member needs permission to manage members.\n\n**Scope:** `team.read` (read teams and members).",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          }
        ],
        "responses": {
          "200": {
            "description": "Assignable roles.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TenantMemberRole"
                  }
                },
                "example": [
                  {
                    "id": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
                    "key": "agent",
                    "name": "Agent"
                  },
                  {
                    "id": "1b2c3d4e-5f6a-4b7c-9d8e-0f1a2b3c4d5e",
                    "key": "team_lead",
                    "name": "Team lead"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "team.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "team.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `team.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /members/roles"
      }
    },
    "/v1/tenants/{tenantSlug}/audit": {
      "get": {
        "operationId": "listAuditEvents",
        "summary": "List audit events",
        "description": "Lists the workspace's audit log, newest first: who did what to which record, with before and after values. Filter by `action` (for example `campaign.created`), `resourceType` and `resourceId`. Paged with an opaque cursor: pass `nextCursor` back as `cursor` until it is `null`.\n\n**Scope:** `audit.read` (read audit log).",
        "tags": [
          "Administration"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "description": "Only events with exactly this action, written `area.record.verb`: for example `lms.lead.created`, `lms.lead.stage_changed`, `lms.lead.assignment_changed`, `campaign.updated` or `integration.api_key.rotated`. Copy the value from an event's `action`.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of records to return in one page.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "resourceId",
            "in": "query",
            "required": false,
            "description": "Only events about this record, usually its ID.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "resourceType",
            "in": "query",
            "required": false,
            "description": "Only events about this kind of record, matched exactly: for example `lead`, `lead_contact`, `campaign`, `process`, `tenant_team`, `tenant_member`, `human_call`, `source_connection` or `integration_api_key`.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of audit events, newest first, and `nextCursor`.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEventPage"
                },
                "example": {
                  "items": [
                    {
                      "id": "d9e0f1a2-b3c4-4d5e-8f6a-7b8c9d0e1f2a",
                      "tenantId": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
                      "occurredAt": "2026-12-01T10:00:00.000Z",
                      "actorType": "USER",
                      "actorId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "action": "campaign.updated",
                      "resourceType": "campaign",
                      "resourceId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f",
                      "correlationId": "8e1d3f5a-4c2b-4a6f-9d8e-3b2c1d0e9f8a",
                      "before": {
                        "name": "Rooftop solar"
                      },
                      "after": {
                        "name": "Rooftop solar · Pune"
                      },
                      "metadata": {
                        "via": "api_key"
                      }
                    }
                  ],
                  "nextCursor": "eyJpZCI6ImQ5ZTBmMWEyLWIzYzQtNGQ1ZS04ZjZhLTdiOGM5ZDBlMWYyYSIsIm9jY3VycmVkQXQiOiIyMDI2LTEyLTAxVDEwOjAwOjAwLjAwMFoifQ"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "audit.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "audit.read",
        "x-errors": [
          {
            "status": 400,
            "code": "VALIDATION_ERROR",
            "when": "A parameter, header or body field is invalid; compare the request with the fields above ([Validation errors](/developers/errors#validation))."
          },
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `audit.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /audit"
      }
    },
    "/v1/tenants/{tenantSlug}/media/{mediaId}/download": {
      "get": {
        "operationId": "getMediaDownloadUrl",
        "summary": "Get a media download link",
        "description": "Returns a short-lived signed URL for a stored media file, such as a Voicebot call recording or transcript listed in an attempt's `media`. Fetch the file from `downloadUrl` within `expiresIn` seconds without sending your API key; request a new link after it expires.\n\n**Scope:** `media.read` (download media).",
        "tags": [
          "Administration"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantSlug"
          },
          {
            "name": "mediaId",
            "in": "path",
            "required": true,
            "description": "Media file ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A signed download link.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaDownloadResponse"
                },
                "example": {
                  "downloadUrl": "https://media.iotindia.example/recordings/8f9a0b1c.wav?X-Amz-Expires=300&X-Amz-Signature=3f1d9c",
                  "expiresIn": 300
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "apiKey": [
              "media.read"
            ]
          },
          {
            "partnerToken": []
          }
        ],
        "x-required-scope": "media.read",
        "x-errors": [
          {
            "status": 401,
            "code": "INVALID_PARTNER_CREDENTIAL",
            "when": "The API key is missing, malformed, revoked or expired."
          },
          {
            "status": 403,
            "code": "PARTNER_OPERATION_FORBIDDEN",
            "when": "The key lacks the `media.read` scope."
          },
          {
            "status": 403,
            "code": "PERMISSION_DENIED",
            "when": "The key's acting member lacks the permission or data access."
          },
          {
            "status": 404,
            "code": "MEDIA_OBJECT_NOT_FOUND",
            "when": "The media file does not exist or the key cannot see it."
          },
          {
            "status": 429,
            "code": "RATE_LIMITED",
            "when": "The key's per-minute budget is spent; wait `Retry-After` seconds."
          },
          {
            "status": 500,
            "code": "UNEXPECTED_ERROR",
            "when": "Something went wrong on our side; retry with backoff and quote `requestId`."
          }
        ],
        "x-partner-operation": "GET /media/{mediaId}/download"
      }
    }
  },
  "webhooks": {
    "lead.created": {
      "post": {
        "operationId": "onLeadCreated",
        "summary": "A new lead was created from any source.",
        "description": "Sent to subscribed endpoints when this happens. Group: Leads. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Leads",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadCreatedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000001",
                "type": "lead.created",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                      "name": "New",
                      "category": "new"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "lead.updated": {
      "post": {
        "operationId": "onLeadUpdated",
        "summary": "A lead's profile, contacts, campaign or priority changed.",
        "description": "Sent to subscribed endpoints when this happens. Group: Leads. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Leads",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadUpdatedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000002",
                "type": "lead.updated",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "changes": [
                    "profile"
                  ],
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "lead.stage_changed": {
      "post": {
        "operationId": "onLeadStageChanged",
        "summary": "A lead moved to another pipeline stage.",
        "description": "Sent to subscribed endpoints when this happens. Group: Leads. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Leads",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadStageChangedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000003",
                "type": "lead.stage_changed",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "previousStage": {
                    "id": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",
                    "name": "New",
                    "category": "new"
                  },
                  "stage": {
                    "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                    "name": "Qualified",
                    "category": "qualified"
                  },
                  "changedAt": "2026-12-01T10:00:00.000Z",
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "lead.assigned": {
      "post": {
        "operationId": "onLeadAssigned",
        "summary": "A lead's owner or team changed.",
        "description": "Sent to subscribed endpoints when this happens. Group: Leads. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Leads",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadAssignedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000004",
                "type": "lead.assigned",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "previousOwner": {
                    "userId": null,
                    "team": {
                      "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                      "name": "West inside sales"
                    }
                  },
                  "owner": {
                    "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                    "team": {
                      "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                      "name": "West inside sales"
                    }
                  },
                  "method": "rule",
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "lead.repeat_enquiry": {
      "post": {
        "operationId": "onLeadRepeatEnquiry",
        "summary": "An existing lead enquired again.",
        "description": "Sent to subscribed endpoints when this happens. Group: Leads. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Leads",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadRepeatEnquiryEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000005",
                "type": "lead.repeat_enquiry",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "enquiry": {
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "externalRecordId": "fb-lead-778812",
                    "receivedAt": "2026-12-01T10:00:00.000Z"
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "lead.merged": {
      "post": {
        "operationId": "onLeadMerged",
        "summary": "Duplicate leads were merged into one.",
        "description": "Sent to subscribed endpoints when this happens. Group: Leads. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Leads",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadMergedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000006",
                "type": "lead.merged",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "mergedLeadIds": [
                    "f0e1d2c3-b4a5-4968-8776-5a4b3c2d1e0f"
                  ],
                  "mergedAt": "2026-12-01T10:00:00.000Z",
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "followup.created": {
      "post": {
        "operationId": "onFollowupCreated",
        "summary": "A follow-up was scheduled for a lead.",
        "description": "Sent to subscribed endpoints when this happens. Group: Follow-ups and callbacks. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Follow-ups and callbacks",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FollowupCreatedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000007",
                "type": "followup.created",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "followUp": {
                    "id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
                    "dueAt": "2026-12-02T05:30:00.000Z",
                    "channel": "phone",
                    "ownerUserId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "followup.due": {
      "post": {
        "operationId": "onFollowupDue",
        "summary": "A scheduled follow-up became due.",
        "description": "Sent to subscribed endpoints when this happens. Group: Follow-ups and callbacks. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Follow-ups and callbacks",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FollowupDueEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000008",
                "type": "followup.due",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "followUp": {
                    "id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
                    "dueAt": "2026-12-02T05:30:00.000Z",
                    "channel": "phone",
                    "ownerUserId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "callback.scheduled": {
      "post": {
        "operationId": "onCallbackScheduled",
        "summary": "A callback was booked for a lead.",
        "description": "Sent to subscribed endpoints when this happens. Group: Follow-ups and callbacks. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Follow-ups and callbacks",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallbackScheduledEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000009",
                "type": "callback.scheduled",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "callback": {
                    "id": "d4c3b2a1-0f9e-4d8c-8b7a-6f5e4d3c2b1a",
                    "scheduledFor": "2026-12-02T06:00:00.000Z",
                    "ownerUserId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                    "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f"
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "call.completed": {
      "post": {
        "operationId": "onCallCompleted",
        "summary": "A call with a lead ended.",
        "description": "Sent to subscribed endpoints when this happens. Group: Calls. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Calls",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallCompletedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000010",
                "type": "call.completed",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "call": {
                    "id": "6f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f",
                    "direction": "outbound",
                    "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                    "agentUserId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                    "startedAt": "2026-12-01T09:59:00.000Z",
                    "answeredAt": "2026-12-01T09:59:08.000Z",
                    "endedAt": "2026-12-01T10:03:20.000Z",
                    "durationSeconds": 260,
                    "talkSeconds": 252,
                    "result": "answered"
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "call.dispositioned": {
      "post": {
        "operationId": "onCallDispositioned",
        "summary": "An agent saved the outcome of a call.",
        "description": "Sent to subscribed endpoints when this happens. Group: Calls. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Calls",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallDispositionedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000011",
                "type": "call.dispositioned",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "call": {
                    "id": "6f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f",
                    "campaignId": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                    "agentUserId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                  },
                  "disposition": {
                    "code": "QUOTE_REQUESTED",
                    "label": "Quote requested",
                    "outcome": "neutral"
                  },
                  "dispositionedAt": "2026-12-01T10:04:00.000Z",
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "recording.available": {
      "post": {
        "operationId": "onRecordingAvailable",
        "summary": "A call recording can be downloaded.",
        "description": "Sent to subscribed endpoints when this happens. Group: Calls. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Calls",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordingAvailableEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000012",
                "type": "recording.available",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "recording": {
                    "id": "rec_01HZX4",
                    "callId": "6f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f",
                    "durationSeconds": 252,
                    "contentType": "audio/mpeg",
                    "availableAt": "2026-12-01T10:05:00.000Z"
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "message.sent": {
      "post": {
        "operationId": "onMessageSent",
        "summary": "A WhatsApp, SMS or email message was sent.",
        "description": "Sent to subscribed endpoints when this happens. Group: Messages. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Messages",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageSentEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000013",
                "type": "message.sent",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "message": {
                    "id": "6d5c4b3a-2f1e-4d0c-9b8a-7f6e5d4c3b2a",
                    "channel": "whatsapp",
                    "direction": "outbound",
                    "templateKey": "quote_follow_up",
                    "sentAt": "2026-12-01T10:00:00.000Z",
                    "deliveredAt": null,
                    "failedAt": null,
                    "failureReason": null
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "message.delivered": {
      "post": {
        "operationId": "onMessageDelivered",
        "summary": "A sent message reached the recipient.",
        "description": "Sent to subscribed endpoints when this happens. Group: Messages. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Messages",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageDeliveredEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000014",
                "type": "message.delivered",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "message": {
                    "id": "6d5c4b3a-2f1e-4d0c-9b8a-7f6e5d4c3b2a",
                    "channel": "whatsapp",
                    "direction": "outbound",
                    "templateKey": "quote_follow_up",
                    "sentAt": "2026-12-01T10:00:00.000Z",
                    "deliveredAt": "2026-12-01T10:00:04.000Z",
                    "failedAt": null,
                    "failureReason": null
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "message.failed": {
      "post": {
        "operationId": "onMessageFailed",
        "summary": "A message could not be delivered.",
        "description": "Sent to subscribed endpoints when this happens. Group: Messages. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Messages",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageFailedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000015",
                "type": "message.failed",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "message": {
                    "id": "6d5c4b3a-2f1e-4d0c-9b8a-7f6e5d4c3b2a",
                    "channel": "whatsapp",
                    "direction": "outbound",
                    "templateKey": "quote_follow_up",
                    "sentAt": "2026-12-01T10:00:00.000Z",
                    "deliveredAt": null,
                    "failedAt": "2026-12-01T10:00:05.000Z",
                    "failureReason": "The number is not on WhatsApp."
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "message.received": {
      "post": {
        "operationId": "onMessageReceived",
        "summary": "A lead replied or wrote in.",
        "description": "Sent to subscribed endpoints when this happens. Group: Messages. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Messages",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageReceivedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000016",
                "type": "message.received",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "message": {
                    "id": "6d5c4b3a-2f1e-4d0c-9b8a-7f6e5d4c3b2a",
                    "channel": "whatsapp",
                    "direction": "inbound",
                    "templateKey": null,
                    "sentAt": "2026-12-01T10:12:00.000Z",
                    "deliveredAt": null,
                    "failedAt": null,
                    "failureReason": null
                  },
                  "text": "Please call me after 6 pm.",
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "sequence.completed": {
      "post": {
        "operationId": "onSequenceCompleted",
        "summary": "A lead finished or left an automated sequence.",
        "description": "Sent to subscribed endpoints when this happens. Group: Automation. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Automation",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SequenceCompletedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000017",
                "type": "sequence.completed",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "sequence": {
                    "id": "e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a8b",
                    "name": "New enquiry nurture"
                  },
                  "enrollmentId": "a9b8c7d6-e5f4-4a3b-9c2d-1e0f9a8b7c6d",
                  "outcome": "completed",
                  "completedAt": "2026-12-05T10:00:00.000Z",
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    },
    "sla.breached": {
      "post": {
        "operationId": "onSlaBreached",
        "summary": "A response or follow-up target was missed.",
        "description": "Sent to subscribed endpoints when this happens. Group: Automation. Version 1.\n\nRespond with any `2xx` within 15 seconds. Other responses, timeouts and redirects are retried up to 12 times with exponential backoff; `410 Gone` disables the endpoint.\n\nVerify `webhook-signature` before trusting the body, and de-duplicate on `webhook-id`.",
        "tags": [
          "Webhooks"
        ],
        "x-event-group": "Automation",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/WebhookTimestamp"
          },
          {
            "$ref": "#/components/parameters/WebhookSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SlaBreachedEvent"
              },
              "example": {
                "id": "0f7e6d5c-4b3a-4291-8f7e-000000000018",
                "type": "sla.breached",
                "version": 1,
                "timestamp": "2026-12-01T10:00:00.000Z",
                "workspace": "your-workspace",
                "data": {
                  "sla": {
                    "policy": {
                      "id": "b7c8d9e0-f1a2-4b3c-8d4e-5f6a7b8c9d0e",
                      "name": "First call in 5 minutes"
                    },
                    "metric": "first_response",
                    "targetAt": "2026-12-01T10:03:13.000Z",
                    "breachedAt": "2026-12-01T10:03:14.000Z",
                    "ownerUserId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a"
                  },
                  "lead": {
                    "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",
                    "contact": {
                      "name": "Asha Verma",
                      "phone": "+919812345678",
                      "email": "asha@example.com"
                    },
                    "company": "Verma Traders",
                    "city": "Pune",
                    "state": "Maharashtra",
                    "country": "India",
                    "productInterest": "Rooftop solar, 5 kW",
                    "priority": 2,
                    "stage": {
                      "id": "5d1f2e3a-9b8c-4d7e-a6f5-1c2b3a4d5e6f",
                      "name": "Qualified",
                      "category": "qualified"
                    },
                    "process": {
                      "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",
                      "name": "Solar sales"
                    },
                    "campaign": {
                      "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
                      "name": "Pune rooftop launch"
                    },
                    "owner": {
                      "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",
                      "team": {
                        "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",
                        "name": "West inside sales"
                      }
                    },
                    "source": {
                      "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",
                      "name": "Meta Lead Ads",
                      "channel": "META"
                    },
                    "receivedAt": "2026-12-01T09:58:12.000Z",
                    "createdAt": "2026-12-01T09:58:13.000Z",
                    "updatedAt": "2026-12-01T10:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Any `2xx` status counts as delivered."
          },
          "410": {
            "description": "Gone. LMS disables the endpoint and stops sending."
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "schemas": {
      "AddTeamMemberRequest": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the user."
          }
        },
        "required": [
          "userId"
        ],
        "additionalProperties": false
      },
      "AgentCallForm": {
        "type": "object",
        "properties": {
          "customer": {
            "description": "Customer fields and values for the call's lead.",
            "$ref": "#/components/schemas/CustomerFieldValuesResponse"
          },
          "settings": {
            "description": "Calling settings of the campaign.",
            "$ref": "#/components/schemas/HumanCallingCampaignResponse"
          }
        },
        "required": [
          "customer",
          "settings"
        ],
        "additionalProperties": false
      },
      "AgentDailyStats": {
        "type": "object",
        "properties": {
          "timezone": {
            "type": "string",
            "description": "Time zone the day is counted in."
          },
          "attempts": {
            "type": "number",
            "description": "Calls placed today."
          },
          "connected": {
            "type": "number",
            "description": "Calls answered today."
          },
          "completed": {
            "type": "number",
            "description": "Calls with a saved outcome today."
          },
          "talkSeconds": {
            "type": "number",
            "description": "Total talk time today, in seconds."
          }
        },
        "required": [
          "timezone",
          "attempts",
          "connected",
          "completed",
          "talkSeconds"
        ],
        "additionalProperties": false
      },
      "AllocationCondition": {
        "type": "object",
        "properties": {
          "field": {
            "description": "Lead field the condition checks.",
            "$ref": "#/components/schemas/AllocationField"
          },
          "operator": {
            "description": "How the field is compared, from the values below.",
            "$ref": "#/components/schemas/OwnershipOperator"
          },
          "value": {
            "$ref": "#/components/schemas/OwnershipConditionValue",
            "description": "The value."
          }
        },
        "required": [
          "field",
          "operator"
        ],
        "additionalProperties": false
      },
      "AllocationField": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "segment.id",
              "campaign.id",
              "source.connectionId",
              "source.definitionKey",
              "lead.productInterest",
              "lead.city",
              "lead.state",
              "lead.country",
              "lead.priority"
            ]
          },
          {
            "type": "string",
            "pattern": "^attributes\\.[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$"
          }
        ]
      },
      "AllocationRulesetDetailResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "currentVersion": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of the published version; `null` before the first publish."
          },
          "currentVersionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the current version; `null` if none."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the allocation ruleset."
          },
          "name": {
            "type": "string",
            "description": "Name of the allocation ruleset, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "status": {
            "$ref": "#/components/schemas/OwnershipConfigurationStatus",
            "description": "Current status of the allocation ruleset."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "fallbackTeamId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the fallback team; `null` if none."
          },
          "rules": {
            "$ref": "#/components/schemas/LeadAllocationRulesV1",
            "description": "Rules, checked in `priority` order; the first match wins."
          },
          "currentVersionData": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AllocationVersionResponse"
              },
              {
                "type": "null"
              }
            ],
            "description": "The published version's content; `null` before the first publish."
          }
        },
        "required": [
          "createdAt",
          "currentVersion",
          "currentVersionId",
          "id",
          "name",
          "processId",
          "revision",
          "status",
          "tenantId",
          "updatedAt",
          "fallbackTeamId",
          "rules",
          "currentVersionData"
        ],
        "additionalProperties": false
      },
      "AllocationRulesetPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AllocationRulesetResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "AllocationRulesetResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "currentVersion": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of the published version; `null` before the first publish."
          },
          "currentVersionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the current version; `null` if none."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the allocation ruleset."
          },
          "name": {
            "type": "string",
            "description": "Name of the allocation ruleset, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "status": {
            "$ref": "#/components/schemas/OwnershipConfigurationStatus",
            "description": "Current status of the allocation ruleset."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "fallbackTeamId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the fallback team; `null` if none."
          },
          "rules": {
            "$ref": "#/components/schemas/LeadAllocationRulesV1",
            "description": "Rules, checked in `priority` order; the first match wins."
          }
        },
        "required": [
          "createdAt",
          "currentVersion",
          "currentVersionId",
          "id",
          "name",
          "processId",
          "revision",
          "status",
          "tenantId",
          "updatedAt",
          "fallbackTeamId",
          "rules"
        ],
        "additionalProperties": false
      },
      "AllocationStrategy": {
        "type": "string",
        "enum": [
          "FIXED_AGENT",
          "TEAM_QUEUE",
          "ROUND_ROBIN"
        ]
      },
      "AllocationVersionResponse": {
        "type": "object",
        "properties": {
          "fallbackTeamId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the fallback team; `null` if none."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the allocation version."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was published (ISO 8601)."
          },
          "publishedBy": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID of the member who published it."
          },
          "rules": {
            "$ref": "#/components/schemas/LeadAllocationRulesV1",
            "description": "Rules, checked in `priority` order; the first match wins."
          },
          "rulesetId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the ruleset."
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Version number."
          }
        },
        "required": [
          "fallbackTeamId",
          "id",
          "processId",
          "publishedAt",
          "publishedBy",
          "rules",
          "rulesetId",
          "version"
        ],
        "additionalProperties": false
      },
      "ApiKeyScope": {
        "type": "string",
        "enum": [
          "leads.read",
          "leads.write",
          "intake.read",
          "intake.write",
          "ownership.read",
          "ownership.write",
          "calling.read",
          "calling.write",
          "reports.read",
          "reports.write",
          "quality.read",
          "quality.write",
          "voicebot.read",
          "voicebot.write",
          "campaigns.read",
          "campaigns.write",
          "team.read",
          "team.write",
          "audit.read",
          "media.read",
          "events.read",
          "intake.submit",
          "recordings.read"
        ]
      },
      "AssignLeadRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 100,
            "pattern": "^[A-Z][A-Z0-9_:-]*$",
            "description": "Your reason code, in upper case (for example `CRM_SYNC`). Kept in the lead's history."
          },
          "teamId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the team."
          },
          "userId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the user; `null` if none."
          }
        },
        "required": [
          "reason",
          "teamId",
          "userId"
        ],
        "additionalProperties": false
      },
      "AuditEventPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the audit event."
                },
                "tenantId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the workspace."
                },
                "occurredAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When it happened (ISO 8601)."
                },
                "actorType": {
                  "type": "string",
                  "enum": [
                    "USER",
                    "SERVICE"
                  ],
                  "description": "`USER` for a member (also through an API key) or `SERVICE` for LMS itself."
                },
                "actorId": {
                  "type": "string",
                  "description": "User ID of the member, or the name of the service."
                },
                "action": {
                  "type": "string",
                  "description": "What happened, as `resource.verb`, for example `campaign.created`."
                },
                "resourceType": {
                  "type": "string",
                  "description": "Kind of record changed, for example `campaign`."
                },
                "resourceId": {
                  "type": "string",
                  "description": "ID of the record changed."
                },
                "requestId": {
                  "type": "string",
                  "description": "`X-Request-Id` of the request that made the change."
                },
                "correlationId": {
                  "type": "string",
                  "description": "Groups the events one user action produced across services."
                },
                "before": {
                  "anyOf": [
                    {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Changed fields before the change; `null` on create."
                },
                "after": {
                  "anyOf": [
                    {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Changed fields after the change; `null` on delete."
                },
                "metadata": {
                  "type": "object",
                  "additionalProperties": {},
                  "description": "Extra details as key–value pairs."
                }
              },
              "required": [
                "id",
                "tenantId",
                "occurredAt",
                "actorType",
                "actorId",
                "action",
                "resourceType",
                "resourceId",
                "requestId",
                "correlationId",
                "before",
                "after",
                "metadata"
              ],
              "additionalProperties": false
            },
            "description": "Audit events, newest first."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "BreakReason": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]{0,39}$",
            "description": "Stable key in upper case, for example `LUNCH`."
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "description": "Name agents see."
          },
          "active": {
            "type": "boolean",
            "description": "Whether agents can pick it."
          }
        },
        "required": [
          "key",
          "label",
          "active"
        ],
        "additionalProperties": false
      },
      "BreakSettings": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision; send it as `expectedRevision` when saving."
          },
          "reasons": {
            "minItems": 1,
            "maxItems": 30,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakReason"
            },
            "description": "Break reasons, in display order."
          }
        },
        "required": [
          "revision",
          "reasons"
        ],
        "additionalProperties": false
      },
      "CallAttemptResponse": {
        "type": "object",
        "properties": {
          "answeredAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the call was answered; `null` if never."
          },
          "attemptNumber": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "1 for the first try, then 2, 3… for retries."
          },
          "billableSeconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Seconds the carrier bills for; `null` until known."
          },
          "callRequestId": {
            "type": "string",
            "format": "uuid",
            "description": "Call request this attempt belongs to."
          },
          "callerNumber": {
            "type": "string",
            "minLength": 3,
            "maxLength": 32,
            "description": "Caller ID used."
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was completed (ISO 8601); `null` if not yet."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "destinationMasked": {
            "type": "string",
            "minLength": 3,
            "maxLength": 32,
            "description": "Number dialled, partly masked."
          },
          "exceptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallOperationsExceptionSummary"
            },
            "description": "Problems recorded for the attempt that need attention."
          },
          "externalCallId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "Telephony provider's call ID."
          },
          "failureCode": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "description": "Machine-readable reason the attempt failed; `null` unless it failed."
          },
          "finalOutcome": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/VoicebotOutcome"
              },
              {
                "type": "null"
              }
            ],
            "description": "Voicebot outcome of the conversation; `null` until known."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call attempt."
          },
          "interactionId": {
            "type": "string",
            "format": "uuid",
            "description": "Conversation the attempt belongs to."
          },
          "media": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallMediaAssetResponse"
            },
            "description": "Recordings and other media of the attempt."
          },
          "providerEndedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the carrier reported the end of the call."
          },
          "providerHangupCause": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "description": "Carrier's hang-up cause, for example `NORMAL_CLEARING`."
          },
          "ringingAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the phone started ringing."
          },
          "status": {
            "description": "Current status of the attempt.",
            "$ref": "#/components/schemas/CallAttemptStatus"
          },
          "streamStartedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the voicebot audio stream started."
          },
          "talkSeconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Seconds after answer; `null` until known."
          },
          "timeline": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallTimelineEvent"
            },
            "description": "Every event of the attempt, oldest first."
          }
        },
        "required": [
          "answeredAt",
          "attemptNumber",
          "billableSeconds",
          "callRequestId",
          "callerNumber",
          "completedAt",
          "createdAt",
          "destinationMasked",
          "exceptions",
          "externalCallId",
          "failureCode",
          "finalOutcome",
          "id",
          "interactionId",
          "media",
          "providerEndedAt",
          "providerHangupCause",
          "ringingAt",
          "status",
          "streamStartedAt",
          "talkSeconds",
          "timeline"
        ],
        "additionalProperties": false
      },
      "CallAttemptStatus": {
        "type": "string",
        "enum": [
          "PLACING",
          "RINGING",
          "ANSWERED",
          "STREAMING",
          "COMPLETED",
          "FAILED",
          "CANCELLED",
          "UNCERTAIN"
        ]
      },
      "CallbackScheduledEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "callback.scheduled",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "callback": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Callback ID (the call it continues)."
                  },
                  "scheduledFor": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the lead should be called back (ISO 8601)."
                  },
                  "ownerUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "User ID of the agent who should call; `null` for any agent in the campaign."
                  },
                  "campaignId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Campaign the callback belongs to."
                  }
                },
                "required": [
                  "id",
                  "scheduledFor",
                  "ownerUserId",
                  "campaignId"
                ],
                "additionalProperties": false,
                "description": "The booked callback."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "callback",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "CallBatchExclusion": {
        "type": "object",
        "properties": {
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead."
          },
          "reason": {
            "$ref": "#/components/schemas/CallBatchExclusionReason",
            "description": "Why, in plain language."
          }
        },
        "required": [
          "leadId",
          "reason"
        ],
        "additionalProperties": false
      },
      "CallBatchExclusionReason": {
        "type": "string",
        "enum": [
          "INVALID_PHONE",
          "SUPPRESSED",
          "ACTIVE_REQUEST_EXISTS",
          "CAMPAIGN_INELIGIBLE",
          "CONFIGURATION_INELIGIBLE"
        ]
      },
      "CallBatchPreviewResponse": {
        "type": "object",
        "properties": {
          "eligibleLeadIds": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of the eligible lead records."
          },
          "exclusions": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallBatchExclusion"
            },
            "description": "Leads left out, with the reason for each."
          },
          "requestedCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "description": "Number of requested records."
          }
        },
        "required": [
          "eligibleLeadIds",
          "exclusions",
          "requestedCount"
        ],
        "additionalProperties": false
      },
      "CallBatchResponse": {
        "type": "object",
        "properties": {
          "acceptedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of accepted records."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "createdBy": {
            "type": "string",
            "format": "uuid",
            "description": "User ID of the member who created it."
          },
          "exclusions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallBatchExclusion"
            },
            "description": "Leads left out, with the reason for each."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call batch."
          },
          "requestedCount": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Number of requested records."
          },
          "status": {
            "$ref": "#/components/schemas/CallBatchStatus",
            "description": "Current status of the call batch."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          }
        },
        "required": [
          "acceptedCount",
          "campaignId",
          "createdAt",
          "createdBy",
          "exclusions",
          "id",
          "requestedCount",
          "status",
          "tenantId"
        ],
        "additionalProperties": false
      },
      "CallBatchStatus": {
        "type": "string",
        "enum": [
          "CREATED",
          "PROCESSING",
          "COMPLETED",
          "CANCELLED"
        ]
      },
      "CallCompletedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "call.completed",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "call": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Call ID."
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "inbound",
                      "outbound"
                    ],
                    "description": "`outbound` when an agent called the lead, `inbound` when the lead called in."
                  },
                  "campaignId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Campaign the call was made under; `null` if none."
                  },
                  "agentUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "User ID of the agent; `null` if no agent took part."
                  },
                  "startedAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When dialling or ringing started (ISO 8601)."
                  },
                  "answeredAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When the call was answered; `null` if it never connected."
                  },
                  "endedAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the call ended (ISO 8601)."
                  },
                  "durationSeconds": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Whole call length in seconds, from `startedAt` to `endedAt`."
                  },
                  "talkSeconds": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Seconds after the call was answered; `0` if it never connected."
                  },
                  "result": {
                    "type": "string",
                    "enum": [
                      "answered",
                      "no_answer",
                      "busy",
                      "failed",
                      "cancelled"
                    ],
                    "description": "How the call ended: `answered`, `no_answer` (rang out), `busy`, `failed` (network or carrier error) or `cancelled` (hung up before it connected)."
                  }
                },
                "required": [
                  "id",
                  "direction",
                  "campaignId",
                  "agentUserId",
                  "startedAt",
                  "answeredAt",
                  "endedAt",
                  "durationSeconds",
                  "talkSeconds",
                  "result"
                ],
                "additionalProperties": false,
                "description": "The call."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "call",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "CallDispositionedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "call.dispositioned",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "call": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Call ID."
                  },
                  "campaignId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Campaign the call was made under."
                  },
                  "agentUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "User ID of the agent who saved the outcome."
                  }
                },
                "required": [
                  "id",
                  "campaignId",
                  "agentUserId"
                ],
                "additionalProperties": false,
                "description": "The call the outcome belongs to."
              },
              "disposition": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Stable key of the outcome, as configured on the campaign."
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300,
                    "description": "Outcome name agents picked, for example `Quote requested`."
                  },
                  "outcome": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "positive",
                          "neutral",
                          "negative",
                          "callback",
                          "unreachable"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Broad meaning of the outcome: `positive`, `neutral`, `negative`, `callback` (call again) or `unreachable`; `null` when the outcome has no category."
                  }
                },
                "required": [
                  "code",
                  "label",
                  "outcome"
                ],
                "additionalProperties": false,
                "description": "The outcome the agent saved."
              },
              "dispositionedAt": {
                "type": "string",
                "format": "date-time",
                "description": "When the outcome was saved (ISO 8601)."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "call",
              "disposition",
              "dispositionedAt",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "CallingActivityInterval": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Interval start."
          },
          "to": {
            "type": "string",
            "format": "date-time",
            "description": "Interval end."
          },
          "state": {
            "description": "What the agent was doing.",
            "$ref": "#/components/schemas/CallingActivityState"
          },
          "campaignId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Campaign, when on a call."
          },
          "callId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Call, when on a call."
          },
          "breakReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Break reason, when on a break."
          }
        },
        "required": [
          "from",
          "to",
          "state",
          "campaignId",
          "callId",
          "breakReason"
        ],
        "additionalProperties": false
      },
      "CallingActivityState": {
        "type": "string",
        "enum": [
          "READY",
          "RINGING",
          "TALKING",
          "WRAP_UP",
          "BREAK",
          "OFFLINE",
          "UNKNOWN"
        ]
      },
      "CallingCohort": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the calling cohort."
          },
          "name": {
            "type": "string",
            "description": "Name of the calling cohort, as shown in the LMS."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether it is turned on."
          },
          "batchId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the batch; `null` if none."
          },
          "leadIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of the lead records."
          },
          "revision": {
            "type": "integer",
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "leadCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of lead records."
          }
        },
        "required": [
          "id",
          "name",
          "enabled",
          "batchId",
          "leadIds",
          "revision",
          "leadCount"
        ],
        "additionalProperties": false
      },
      "CallingCohortOptions": {
        "type": "object",
        "properties": {
          "leads": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the lead."
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Name of the lead, as shown in the LMS."
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            },
            "description": "Leads you can pick from."
          },
          "batches": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the batch."
                },
                "name": {
                  "type": "string",
                  "description": "Name of the batch, as shown in the LMS."
                },
                "receivedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When it was received (ISO 8601)."
                }
              },
              "required": [
                "id",
                "name",
                "receivedAt"
              ],
              "additionalProperties": false
            },
            "description": "Import batches you can pick from."
          },
          "nextOffset": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `offset` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "leads",
          "batches",
          "nextOffset"
        ],
        "additionalProperties": false
      },
      "CallingCohorts": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallingCohort"
            },
            "description": "The records in this response, in the documented order."
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "CallingProfilePageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallingProfileSummary"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Always `null`: every calling profile comes in this one response."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "CallingProfileStatus": {
        "type": "string",
        "enum": [
          "PROVISIONING",
          "ACTIVE",
          "SUSPENDED"
        ]
      },
      "CallingProfileSummary": {
        "type": "object",
        "properties": {
          "callerIds": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "displayName": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Name shown in the LMS."
                },
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the caller ID."
                },
                "phoneNumber": {
                  "type": "string",
                  "pattern": "^\\+[1-9]\\d{6,14}$",
                  "description": "Phone number in E.164 format, for example `+919812345678`."
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ACTIVE",
                    "DISABLED"
                  ],
                  "description": "Current status of the caller ID."
                }
              },
              "required": [
                "displayName",
                "id",
                "phoneNumber",
                "status"
              ],
              "additionalProperties": false
            },
            "description": "IDs of the caller records."
          },
          "concurrencyLimit": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Most voicebot calls at once."
          },
          "displayName": {
            "type": "string",
            "minLength": 2,
            "maxLength": 120,
            "description": "Name shown in the LMS."
          },
          "healthStatus": {
            "type": "string",
            "enum": [
              "UNKNOWN",
              "HEALTHY",
              "DEGRADED",
              "UNHEALTHY"
            ],
            "description": "Whether the profile is working, from the values below."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the calling profile."
          },
          "status": {
            "$ref": "#/components/schemas/CallingProfileStatus",
            "description": "Current status of the calling profile."
          }
        },
        "required": [
          "callerIds",
          "concurrencyLimit",
          "displayName",
          "healthStatus",
          "id",
          "status"
        ],
        "additionalProperties": false
      },
      "CallingReassignmentOptions": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "teamId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the team."
                },
                "teamName": {
                  "type": "string",
                  "description": "Name of the team, as shown in the LMS."
                },
                "userId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the user."
                },
                "name": {
                  "type": "string",
                  "description": "Name of the calling reassignment, as shown in the LMS."
                }
              },
              "required": [
                "teamId",
                "teamName",
                "userId",
                "name"
              ],
              "additionalProperties": false
            },
            "description": "The records in this response, in the documented order."
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "CallingReport": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the report period."
          },
          "to": {
            "type": "string",
            "format": "date-time",
            "description": "End of the report period."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the report was computed."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign ID."
          },
          "nextOffset": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `offset` for more agents; `null` on the last page."
          },
          "agents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "userId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "Member's user ID."
                },
                "name": {
                  "type": "string",
                  "description": "Member's name."
                },
                "intervals": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CallingActivityInterval"
                  },
                  "description": "Timeline of what the agent was doing."
                },
                "seconds": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "READY",
                    "RINGING",
                    "TALKING",
                    "WRAP_UP",
                    "BREAK",
                    "OFFLINE",
                    "UNKNOWN"
                  ],
                  "description": "Seconds spent in each state (`READY`, `RINGING`, `TALKING`, `WRAP_UP`, `BREAK`, `OFFLINE`, `UNKNOWN`).",
                  "properties": {
                    "READY": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Seconds spent in the `READY` state."
                    },
                    "RINGING": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Seconds spent in the `RINGING` state."
                    },
                    "TALKING": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Seconds spent in the `TALKING` state."
                    },
                    "WRAP_UP": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Seconds spent in the `WRAP_UP` state."
                    },
                    "BREAK": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Seconds spent in the `BREAK` state."
                    },
                    "OFFLINE": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Seconds spent in the `OFFLINE` state."
                    },
                    "UNKNOWN": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Seconds spent in the `UNKNOWN` state."
                    }
                  }
                },
                "attempts": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Calls placed."
                },
                "contacts": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Calls answered by the customer."
                },
                "retries": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Calls that were retries of an earlier attempt."
                },
                "callbacksScheduled": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Callbacks booked."
                },
                "callbacksCompleted": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Callbacks done."
                },
                "callbacksOverdue": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Callbacks past due and not done."
                },
                "unresolved": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Calls still waiting for an outcome."
                },
                "evidenceTalkSeconds": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Talk time confirmed by telephony, in seconds."
                },
                "medianFirstContactMinutes": {
                  "default": null,
                  "description": "Median minutes from a lead's arrival to its first call; `null` without data.",
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "medianReplyMinutes": {
                  "default": null,
                  "description": "Median minutes to reply to a lead's message; `null` without data.",
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "userId",
                "name",
                "intervals",
                "seconds",
                "attempts",
                "contacts",
                "retries",
                "callbacksScheduled",
                "callbacksCompleted",
                "callbacksOverdue",
                "unresolved",
                "evidenceTalkSeconds",
                "medianFirstContactMinutes",
                "medianReplyMinutes"
              ],
              "additionalProperties": false
            },
            "description": "One row per agent."
          }
        },
        "required": [
          "from",
          "to",
          "observedAt",
          "campaignId",
          "nextOffset",
          "agents"
        ],
        "additionalProperties": false
      },
      "CallingWorkQueue": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "leadId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the lead."
                },
                "leadName": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Name of the lead, as shown in the LMS."
                },
                "contactId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the contact."
                },
                "callId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "ID of the call; `null` if none."
                },
                "ownerId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "ID of the owner; `null` if none."
                },
                "ownerName": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Name of the owner, as shown in the LMS."
                },
                "dueAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When it is due (ISO 8601); `null` if not yet."
                },
                "revision": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
                },
                "reason": {
                  "type": "string",
                  "description": "Why, in plain language."
                },
                "attempts": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Call attempts made so far."
                }
              },
              "required": [
                "leadId",
                "leadName",
                "contactId",
                "callId",
                "ownerId",
                "ownerName",
                "dueAt",
                "revision",
                "reason",
                "attempts"
              ],
              "additionalProperties": false
            },
            "description": "The records in this response, in the documented order."
          },
          "nextOffset": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `offset` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextOffset"
        ],
        "additionalProperties": false
      },
      "CallingWorkReassigned": {
        "type": "object",
        "properties": {
          "saved": {
            "type": "boolean",
            "const": true,
            "description": "Always `true`: the change was saved."
          }
        },
        "required": [
          "saved"
        ],
        "additionalProperties": false
      },
      "CallMediaAssetResponse": {
        "type": "object",
        "properties": {
          "attemptId": {
            "type": "string",
            "format": "uuid",
            "description": "Call attempt the media belongs to."
          },
          "available": {
            "type": "boolean",
            "description": "Whether it can be downloaded now."
          },
          "byteLength": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "File size in bytes; `null` until stored."
          },
          "contentType": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Media type, for example `audio/wav`."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "deletedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was deleted; `null` unless deleted."
          },
          "deletionReason": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "description": "Why it was deleted."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it will be deleted under the retention policy."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Media ID."
          },
          "integrityStatus": {
            "description": "Result of the integrity check of the stored file.",
            "$ref": "#/components/schemas/CallMediaIntegrityStatus"
          },
          "kind": {
            "type": "string",
            "enum": [
              "CALL_RECORDING",
              "TRANSCRIPT"
            ],
            "description": "Kind of call media asset."
          },
          "sha256": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              {
                "type": "null"
              }
            ],
            "description": "SHA-256 of the file, in hex; `null` until stored."
          },
          "source": {
            "type": "string",
            "enum": [
              "PLIVO",
              "VOICEBOT"
            ],
            "description": "Where it came from: `PLIVO` (telephony) or `VOICEBOT`."
          },
          "status": {
            "description": "Processing status.",
            "$ref": "#/components/schemas/CallMediaStatus"
          },
          "validatedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the file passed validation."
          }
        },
        "required": [
          "attemptId",
          "available",
          "byteLength",
          "contentType",
          "createdAt",
          "deletedAt",
          "deletionReason",
          "expiresAt",
          "id",
          "integrityStatus",
          "kind",
          "sha256",
          "source",
          "status",
          "validatedAt"
        ],
        "additionalProperties": false
      },
      "CallMediaIntegrityStatus": {
        "type": "string",
        "enum": [
          "PENDING",
          "VALID",
          "INVALID"
        ]
      },
      "CallMediaStatus": {
        "type": "string",
        "enum": [
          "PENDING_UPLOAD",
          "UPLOADED",
          "PENDING_INGESTION",
          "INGESTING",
          "VALIDATED",
          "FAILED",
          "QUARANTINED",
          "DELETED"
        ]
      },
      "CallOperationsExceptionCategory": {
        "type": "string",
        "enum": [
          "CALLBACK_AUTH",
          "CALLBACK_CONFLICT",
          "OUTCOME_CONFLICT",
          "MISSING_PROVIDER_END",
          "MISSING_VOICEBOT_OUTCOME",
          "STUCK_RESERVATION",
          "RECONCILIATION",
          "MEDIA_RECORDING",
          "MEDIA_INGESTION",
          "MEDIA_RETENTION",
          "DLQ"
        ]
      },
      "CallOperationsExceptionPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallOperationsExceptionSummary"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Always `null`: this list is not paged. Narrow it with the `category` and `status` filters instead."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "CallOperationsExceptionStatus": {
        "type": "string",
        "enum": [
          "OPEN",
          "RESOLVED",
          "IGNORED"
        ]
      },
      "CallOperationsExceptionSummary": {
        "type": "object",
        "properties": {
          "attemptId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the attempt; `null` if none."
          },
          "category": {
            "$ref": "#/components/schemas/CallOperationsExceptionCategory",
            "description": "Category, from the values below."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Machine-readable code. Branch on this, not on the label."
          },
          "firstObservedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was first observed (ISO 8601)."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call operations exception."
          },
          "lastObservedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was last observed (ISO 8601)."
          },
          "occurrenceCount": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Number of occurrence records."
          },
          "safeDetail": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "maxLength": 100
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 500
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            },
            "description": "Plain-language detail with personal data removed."
          },
          "status": {
            "$ref": "#/components/schemas/CallOperationsExceptionStatus",
            "description": "Current status of the call operations exception."
          }
        },
        "required": [
          "attemptId",
          "category",
          "code",
          "firstObservedAt",
          "id",
          "lastObservedAt",
          "occurrenceCount",
          "safeDetail",
          "status"
        ],
        "additionalProperties": false
      },
      "CallRequestPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CallRequestResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "CallRequestResponse": {
        "type": "object",
        "properties": {
          "attemptsUsed": {
            "type": "integer",
            "minimum": 0,
            "description": "Attempts made so far."
          },
          "batchId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the batch."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "configurationVersionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the configuration version."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call."
          },
          "latestAttemptId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the latest attempt; `null` if none."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead."
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "Most call attempts per lead."
          },
          "nextEligibleAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Next eligible time (ISO 8601); `null` if not yet."
          },
          "status": {
            "$ref": "#/components/schemas/CallRequestStatus",
            "description": "Current status of the call."
          },
          "terminalReason": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the request stopped for good; `null` while it can still be retried."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "attemptsUsed",
          "batchId",
          "campaignId",
          "configurationVersionId",
          "createdAt",
          "id",
          "latestAttemptId",
          "leadId",
          "maxAttempts",
          "nextEligibleAt",
          "status",
          "terminalReason",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CallRequestStatus": {
        "type": "string",
        "enum": [
          "QUEUED",
          "WAITING_FOR_WINDOW",
          "WAITING_FOR_CAPACITY",
          "IN_PROGRESS",
          "COMPLETED",
          "EXHAUSTED",
          "SUPPRESSED",
          "CANCELLED",
          "FAILED"
        ]
      },
      "CallTimelineEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call timeline."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (ISO 8601)."
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was recorded (ISO 8601)."
          },
          "safeDetail": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "maxLength": 100
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 500
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            },
            "description": "Plain-language detail with personal data removed."
          },
          "source": {
            "type": "string",
            "enum": [
              "SYSTEM",
              "PLIVO",
              "VOICEBOT",
              "LMS"
            ],
            "description": "Which system recorded it."
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Kind of call timeline."
          }
        },
        "required": [
          "id",
          "occurredAt",
          "recordedAt",
          "safeDetail",
          "source",
          "type"
        ],
        "additionalProperties": false
      },
      "CampaignAgentDashboard": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign ID."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When these states were read (ISO 8601)."
          },
          "streamHealthy": {
            "type": "boolean",
            "description": "Whether live telephony updates are flowing; when `false`, states may lag."
          },
          "counts": {
            "type": "object",
            "properties": {
              "ON_CALL": {
                "type": "integer",
                "minimum": 0,
                "description": "Agents on a call."
              },
              "BREAK": {
                "type": "integer",
                "minimum": 0,
                "description": "Agents on a break."
              },
              "IDLE": {
                "type": "integer",
                "minimum": 0,
                "description": "Agents ready and waiting."
              },
              "WRAP_UP": {
                "type": "integer",
                "minimum": 0,
                "description": "Agents saving an outcome."
              },
              "OFFLINE": {
                "type": "integer",
                "minimum": 0,
                "description": "Agents signed out of calling."
              },
              "UNAVAILABLE": {
                "type": "integer",
                "minimum": 0,
                "description": "Agents who cannot take calls (for example no phone)."
              }
            },
            "required": [
              "ON_CALL",
              "BREAK",
              "IDLE",
              "WRAP_UP",
              "OFFLINE",
              "UNAVAILABLE"
            ],
            "additionalProperties": false,
            "description": "Number of agents in each state."
          },
          "agents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "userId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "Member's user ID."
                },
                "name": {
                  "type": "string",
                  "description": "Member's name."
                },
                "state": {
                  "description": "Current state.",
                  "$ref": "#/components/schemas/CampaignAgentState"
                },
                "connected": {
                  "type": "boolean",
                  "description": "Whether the agent's phone is connected."
                },
                "callId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Live call; `null` if none."
                },
                "leadName": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Lead on the live call."
                },
                "since": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When the agent entered this state."
                },
                "reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Why the agent is unavailable or on a break."
                }
              },
              "required": [
                "userId",
                "name",
                "state",
                "connected",
                "callId",
                "leadName",
                "since",
                "reason"
              ],
              "additionalProperties": false
            },
            "description": "One row per agent."
          }
        },
        "required": [
          "campaignId",
          "observedAt",
          "streamHealthy",
          "counts",
          "agents"
        ],
        "additionalProperties": false
      },
      "CampaignAgentOptions": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "userId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the user."
                },
                "name": {
                  "type": "string",
                  "description": "Name of the campaign agent, as shown in the LMS."
                },
                "assignedCampaignId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "ID of the assigned campaign; `null` if none."
                },
                "assignedCampaignName": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Name of the assigned campaign, as shown in the LMS."
                }
              },
              "required": [
                "userId",
                "name",
                "assignedCampaignId",
                "assignedCampaignName"
              ],
              "additionalProperties": false
            },
            "description": "The records in this response, in the documented order."
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "CampaignAgentState": {
        "type": "string",
        "enum": [
          "ON_CALL",
          "BREAK",
          "IDLE",
          "WRAP_UP",
          "OFFLINE",
          "UNAVAILABLE"
        ]
      },
      "CampaignCustomerForm": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign the form belongs to."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Form revision, increased on every change. Send it as `formRevision` when saving values."
          },
          "fields": {
            "description": "The fields, in display order.",
            "$ref": "#/components/schemas/CustomerFields"
          },
          "updatedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the form last changed; `null` if never saved."
          }
        },
        "required": [
          "campaignId",
          "revision",
          "fields",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CampaignDisposition": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$",
            "description": "Stable machine key. Unlike the label, it never changes."
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Display label."
          },
          "outcome": {
            "$ref": "#/components/schemas/HumanCallOutcome",
            "description": "Outcome, from the values below."
          },
          "active": {
            "default": true,
            "type": "boolean",
            "description": "Whether it is active."
          },
          "requiresNote": {
            "default": false,
            "description": "Whether agents must add a note when they pick it.",
            "type": "boolean"
          },
          "parentKey": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Key of the parent outcome, for a sub-outcome; `null` at the top level."
          },
          "requiredFieldKeys": {
            "maxItems": 60,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            },
            "description": "Customer fields that must be filled before this outcome can be saved."
          }
        },
        "required": [
          "key",
          "label",
          "outcome",
          "active",
          "requiresNote"
        ],
        "additionalProperties": false
      },
      "CampaignDispositionInput": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$",
            "description": "Stable machine key. Unlike the label, it never changes."
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Display label."
          },
          "outcome": {
            "$ref": "#/components/schemas/HumanCallOutcome",
            "description": "Outcome, from the values below."
          },
          "active": {
            "default": true,
            "type": "boolean",
            "description": "Whether it is active."
          },
          "requiresNote": {
            "default": false,
            "description": "Whether agents must add a note when they pick it.",
            "type": "boolean"
          },
          "parentKey": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Key of the parent outcome, for a sub-outcome; `null` at the top level."
          },
          "requiredFieldKeys": {
            "maxItems": 60,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            },
            "description": "Customer fields that must be filled before this outcome can be saved."
          }
        },
        "required": [
          "key",
          "label",
          "outcome"
        ],
        "additionalProperties": false
      },
      "CampaignDispositions": {
        "minItems": 1,
        "maxItems": 61,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/CampaignDisposition"
        }
      },
      "CampaignDispositionsInput": {
        "minItems": 1,
        "maxItems": 61,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/CampaignDispositionInput"
        }
      },
      "CampaignId": {
        "type": "string",
        "format": "uuid"
      },
      "CampaignModuleKey": {
        "type": "string",
        "enum": [
          "LMS",
          "DIALER",
          "QMS",
          "IVR",
          "VOICEBOT"
        ]
      },
      "CampaignModuleResponse": {
        "type": "object",
        "properties": {
          "campaignId": {
            "$ref": "#/components/schemas/CampaignId",
            "description": "ID of the campaign."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether it is turned on."
          },
          "module": {
            "description": "Campaign module key.",
            "$ref": "#/components/schemas/CampaignModuleKey"
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "campaignId",
          "enabled",
          "module",
          "tenantId",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CampaignModuleUpdateRequest": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether it is turned on."
          }
        },
        "required": [
          "enabled"
        ],
        "additionalProperties": false
      },
      "CampaignPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "CampaignResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "description": {
            "type": "string",
            "description": "Free-text description."
          },
          "endsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it ends (ISO 8601); `null` if not yet."
          },
          "id": {
            "$ref": "#/components/schemas/CampaignId",
            "description": "ID of the campaign."
          },
          "name": {
            "type": "string",
            "description": "Name of the campaign, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "startsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it starts (ISO 8601); `null` if not yet."
          },
          "status": {
            "$ref": "#/components/schemas/CampaignStatus",
            "description": "Current status of the campaign."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "timezone": {
            "type": "string",
            "description": "IANA time zone, for example `Asia/Kolkata`."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "createdAt",
          "description",
          "endsAt",
          "id",
          "name",
          "processId",
          "startsAt",
          "status",
          "tenantId",
          "timezone",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "CampaignStatus": {
        "type": "string",
        "enum": [
          "DRAFT",
          "ACTIVE",
          "PAUSED",
          "ARCHIVED"
        ]
      },
      "CancelCallRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 500,
            "description": "Why you are cancelling (3–500 characters); kept in the audit trail."
          }
        },
        "required": [
          "reason"
        ],
        "additionalProperties": false
      },
      "CdrCatalogue": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1,
            "description": "Version number."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "timezone": {
            "type": "string",
            "description": "IANA time zone, for example `Asia/Kolkata`."
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CdrField"
            },
            "description": "The fields, in display order."
          }
        },
        "required": [
          "version",
          "campaignId",
          "processId",
          "timezone",
          "fields"
        ],
        "additionalProperties": false
      },
      "CdrCell": {
        "type": "object",
        "properties": {
          "value": {
            "$ref": "#/components/schemas/CustomerFieldValue",
            "description": "The value."
          },
          "status": {
            "type": "string",
            "enum": [
              "VALUE",
              "UNKNOWN",
              "PENDING",
              "NOT_APPLICABLE",
              "MASKED",
              "HISTORICAL_UNAVAILABLE",
              "INVALID"
            ],
            "description": "Current status of the call detail record cell."
          },
          "provisional": {
            "default": false,
            "description": "`true` while the value may still change (for example the call is still open).",
            "type": "boolean"
          },
          "sourceLabel": {
            "description": "Name of the field the value came from.",
            "type": "string"
          },
          "sourceType": {
            "description": "Value type of the source field.",
            "$ref": "#/components/schemas/CdrValueType"
          },
          "displayValue": {
            "description": "Value formatted for display.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "formRevision": {
            "description": "Customer form revision the value was saved with.",
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "value",
          "status",
          "provisional"
        ],
        "additionalProperties": false
      },
      "CdrColumn": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 180,
            "description": "Stable machine key. Unlike the label, it never changes."
          },
          "type": {
            "$ref": "#/components/schemas/CdrValueType",
            "description": "Kind of call detail record column."
          },
          "heading": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Column heading in the report."
          }
        },
        "required": [
          "key",
          "type",
          "heading"
        ],
        "additionalProperties": false
      },
      "CdrDefinition": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1,
            "description": "Version number."
          },
          "columns": {
            "minItems": 1,
            "maxItems": 80,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CdrColumn"
            },
            "description": "Columns, in display order."
          },
          "primaryKey": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 180
              },
              {
                "type": "null"
              }
            ],
            "description": "Field that identifies a row, for de-duplicating exports; `null` for the default."
          },
          "timeBasis": {
            "type": "string",
            "enum": [
              "CALL_CREATED",
              "CALL_ENDED",
              "ACTIVE_DURING"
            ],
            "description": "Which call time the period filters on: `CALL_CREATED`, `CALL_ENDED` or `ACTIVE_DURING`."
          },
          "selection": {
            "description": "Filters the report applies.",
            "$ref": "#/components/schemas/CdrSelection"
          }
        },
        "required": [
          "version",
          "columns",
          "primaryKey",
          "timeBasis",
          "selection"
        ],
        "additionalProperties": false
      },
      "CdrDefinitionInput": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1,
            "description": "Version number."
          },
          "columns": {
            "minItems": 1,
            "maxItems": 80,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CdrColumn"
            },
            "description": "Columns, in display order."
          },
          "primaryKey": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 180
              },
              {
                "type": "null"
              }
            ],
            "description": "Field that identifies a row, for de-duplicating exports; `null` for the default."
          },
          "timeBasis": {
            "type": "string",
            "enum": [
              "CALL_CREATED",
              "CALL_ENDED",
              "ACTIVE_DURING"
            ],
            "description": "Which call time the period filters on: `CALL_CREATED`, `CALL_ENDED` or `ACTIVE_DURING`."
          },
          "selection": {
            "description": "Filters the report applies.",
            "$ref": "#/components/schemas/CdrSelectionInput"
          }
        },
        "required": [
          "version",
          "columns",
          "primaryKey",
          "timeBasis",
          "selection"
        ],
        "additionalProperties": false
      },
      "CdrExport": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call detail record export."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "format": {
            "type": "string",
            "enum": [
              "CSV",
              "XLSX"
            ],
            "description": "`CSV` or `XLSX`."
          },
          "view": {
            "type": "string",
            "enum": [
              "CALLS",
              "LEAD",
              "ACCOUNT"
            ],
            "description": "`CALLS` (one row per call), `LEAD` (one row per lead) or `ACCOUNT` (grouped by an account field)."
          },
          "state": {
            "type": "string",
            "enum": [
              "QUEUED",
              "PROCESSING",
              "READY",
              "FAILED",
              "CANCELLED",
              "EXPIRED"
            ],
            "description": "Current state of the call detail record export."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "capturedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was captured (ISO 8601); `null` if not yet."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it expires (ISO 8601)."
          },
          "rowCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of row records."
          },
          "byteLength": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "File size in bytes; `null` until ready."
          },
          "sha256": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              {
                "type": "null"
              }
            ],
            "description": "SHA-256 checksum of the file, in hex."
          },
          "errorCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the export failed; `null` unless it failed."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the period (ISO 8601), inclusive."
          },
          "to": {
            "type": "string",
            "format": "date-time",
            "description": "End of the period (ISO 8601), inclusive."
          }
        },
        "required": [
          "id",
          "campaignId",
          "format",
          "view",
          "state",
          "createdAt",
          "capturedAt",
          "expiresAt",
          "rowCount",
          "byteLength",
          "sha256",
          "errorCode",
          "from",
          "to"
        ],
        "additionalProperties": false
      },
      "CdrExportRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call detail record export."
          },
          "format": {
            "type": "string",
            "enum": [
              "CSV",
              "XLSX"
            ],
            "description": "`CSV` or `XLSX`."
          },
          "view": {
            "default": "CALLS",
            "description": "`CALLS` (one row per call), `LEAD` (one row per lead) or `ACCOUNT` (grouped by an account field).",
            "type": "string",
            "enum": [
              "CALLS",
              "LEAD",
              "ACCOUNT"
            ]
          },
          "accountFieldKey": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$",
            "description": "Customer field that identifies the account, when rows are grouped by account."
          },
          "definition": {
            "$ref": "#/components/schemas/CdrDefinitionInput",
            "description": "What the report contains: columns, filters and time basis."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the period (ISO 8601), inclusive."
          },
          "to": {
            "type": "string",
            "format": "date-time",
            "description": "End of the period (ISO 8601), inclusive."
          }
        },
        "required": [
          "id",
          "format",
          "definition",
          "from",
          "to"
        ],
        "additionalProperties": false
      },
      "CdrExports": {
        "type": "object",
        "properties": {
          "items": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CdrExport"
            },
            "description": "The records in this response, in the documented order."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether it is turned on."
          }
        },
        "required": [
          "items",
          "enabled"
        ],
        "additionalProperties": false
      },
      "CdrField": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 180,
            "description": "ID of the call detail record field."
          },
          "label": {
            "type": "string",
            "description": "Display label."
          },
          "group": {
            "type": "string",
            "enum": [
              "IDENTITY",
              "CALL",
              "TIMING",
              "DISPOSITION",
              "CALLBACK",
              "CUSTOMER"
            ],
            "description": "Where the field sits in the picker: `IDENTITY`, `CALL`, `TIMING`, `DISPOSITION`, `CALLBACK` or `CUSTOMER`."
          },
          "type": {
            "$ref": "#/components/schemas/CdrValueType",
            "description": "Kind of call detail record field."
          },
          "temporal": {
            "type": "string",
            "enum": [
              "CALL_FACT",
              "AT_WRAP_UP",
              "CURRENT_SAVED"
            ],
            "description": "When the value is taken: `CALL_FACT` (from the call), `AT_WRAP_UP` (as saved at wrap-up) or `CURRENT_SAVED` (today's value)."
          },
          "description": {
            "type": "string",
            "description": "Free-text description."
          },
          "campaignId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the campaign; `null` if none."
          },
          "customerFieldKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Customer field it reads; `null` for built-in fields."
          },
          "historicalOnly": {
            "type": "boolean",
            "description": "Whether it exists only on older calls."
          },
          "masked": {
            "type": "boolean",
            "description": "Whether values are hidden from members without permission to see them."
          }
        },
        "required": [
          "id",
          "label",
          "group",
          "type",
          "temporal",
          "description",
          "campaignId",
          "customerFieldKey",
          "historicalOnly",
          "masked"
        ],
        "additionalProperties": false
      },
      "CdrHistoryPage": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1,
            "description": "Version number."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead."
          },
          "timezone": {
            "type": "string",
            "description": "IANA time zone, for example `Asia/Kolkata`."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was observed (ISO 8601)."
          },
          "consistency": {
            "type": "string",
            "const": "LIVE_PAGE",
            "description": "How current the data is: `LIVE_PAGE` means read live when the page was built."
          },
          "anchor": {
            "description": "The call the history is centred on.",
            "$ref": "#/components/schemas/CdrRow"
          },
          "items": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CdrRow"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "version",
          "campaignId",
          "leadId",
          "timezone",
          "observedAt",
          "consistency",
          "anchor",
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "CdrPage": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1,
            "description": "Version number."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "timezone": {
            "type": "string",
            "description": "IANA time zone, for example `Asia/Kolkata`."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the period (ISO 8601), inclusive."
          },
          "to": {
            "type": "string",
            "format": "date-time",
            "description": "End of the period (ISO 8601), inclusive."
          },
          "timeBasis": {
            "default": "CALL_CREATED",
            "description": "Which call time the period filters on: when the call was created, when it ended, or any time it was active.",
            "type": "string",
            "enum": [
              "CALL_CREATED",
              "CALL_ENDED",
              "ACTIVE_DURING"
            ]
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was observed (ISO 8601)."
          },
          "consistency": {
            "type": "string",
            "const": "LIVE_PAGE",
            "description": "How current the data is: `LIVE_PAGE` means read live when the page was built."
          },
          "lastTelephonySyncAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was last telephony sync (ISO 8601); `null` if not yet."
          },
          "telephonySync": {
            "type": "string",
            "enum": [
              "FRESH",
              "STALE",
              "UNAVAILABLE"
            ],
            "description": "How current telephony data is: `FRESH`, `STALE` (behind) or `UNAVAILABLE`."
          },
          "items": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CdrRow"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "version",
          "campaignId",
          "processId",
          "timezone",
          "from",
          "to",
          "timeBasis",
          "observedAt",
          "consistency",
          "lastTelephonySyncAt",
          "telephonySync",
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "CdrRow": {
        "type": "object",
        "properties": {
          "callId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "attemptId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the attempt; `null` if none."
          },
          "phase": {
            "type": "string",
            "enum": [
              "PENDING",
              "AGENT_CONNECTING",
              "DIALING",
              "CUSTOMER_ANSWERED",
              "CONNECTED",
              "ENDING",
              "ENDED",
              "UNCERTAIN"
            ],
            "description": "Where the call is: from request to wrap-up."
          },
          "state": {
            "$ref": "#/components/schemas/HumanCallState",
            "description": "Current state of the call detail record."
          },
          "wrapUpStatus": {
            "type": "string",
            "enum": [
              "PENDING",
              "SAVED",
              "NOT_REQUIRED",
              "HISTORICAL_UNAVAILABLE",
              "INVALID"
            ],
            "description": "`PENDING`, `SAVED`, `NOT_REQUIRED`, `HISTORICAL_UNAVAILABLE` (older call without wrap-up data) or `INVALID`."
          },
          "customerDialed": {
            "type": "string",
            "enum": [
              "UNKNOWN",
              "CONFIRMED",
              "NOT_DIALED"
            ],
            "description": "Whether the customer's number was dialled: `CONFIRMED`, `NOT_DIALED` or `UNKNOWN`."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "executionRevision": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Telephony execution revision; `null` before the call was placed."
          },
          "fields": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/CdrCell"
            },
            "description": "The fields, in display order."
          }
        },
        "required": [
          "callId",
          "leadId",
          "campaignId",
          "attemptId",
          "phase",
          "state",
          "wrapUpStatus",
          "customerDialed",
          "revision",
          "executionRevision",
          "fields"
        ],
        "additionalProperties": false
      },
      "CdrSelection": {
        "type": "object",
        "properties": {
          "order": {
            "default": "NEWEST",
            "type": "string",
            "enum": [
              "NEWEST",
              "OLDEST"
            ],
            "description": "Sort direction."
          },
          "state": {
            "$ref": "#/components/schemas/HumanCallState",
            "description": "Current state of the call detail record selection."
          },
          "agentId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the agent."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead."
          },
          "wrapUp": {
            "default": "ALL",
            "description": "`ALL`, `RECORDED` (wrap-up saved) or `AWAITING` (wrap-up still due).",
            "type": "string",
            "enum": [
              "ALL",
              "RECORDED",
              "AWAITING"
            ]
          },
          "dispositionKey": {
            "description": "Only calls with this disposition key.",
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        },
        "required": [
          "order",
          "wrapUp"
        ],
        "additionalProperties": false
      },
      "CdrSelectionInput": {
        "type": "object",
        "properties": {
          "order": {
            "default": "NEWEST",
            "type": "string",
            "enum": [
              "NEWEST",
              "OLDEST"
            ],
            "description": "Sort direction."
          },
          "state": {
            "$ref": "#/components/schemas/HumanCallState",
            "description": "Current state of the call detail record selection."
          },
          "agentId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the agent."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead."
          },
          "wrapUp": {
            "default": "ALL",
            "description": "`ALL`, `RECORDED` (wrap-up saved) or `AWAITING` (wrap-up still due).",
            "type": "string",
            "enum": [
              "ALL",
              "RECORDED",
              "AWAITING"
            ]
          },
          "dispositionKey": {
            "description": "Only calls with this disposition key.",
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        },
        "additionalProperties": false
      },
      "CdrSummaryCounts": {
        "type": "object",
        "properties": {
          "requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Call requests."
          },
          "ended": {
            "type": "integer",
            "minimum": 0,
            "description": "Calls that ended."
          },
          "open": {
            "type": "integer",
            "minimum": 0,
            "description": "Calls still in progress."
          },
          "uncertain": {
            "type": "integer",
            "minimum": 0,
            "description": "Calls whose result telephony has not confirmed."
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "description": "Calls that failed."
          },
          "wrapUpRecords": {
            "type": "integer",
            "minimum": 0,
            "description": "Calls with a saved wrap-up."
          },
          "awaitingWrapUp": {
            "type": "integer",
            "minimum": 0,
            "description": "Calls whose wrap-up is still due."
          },
          "openCallbacks": {
            "type": "integer",
            "minimum": 0,
            "description": "Callbacks not done yet."
          },
          "overdueCallbacks": {
            "type": "integer",
            "minimum": 0,
            "description": "Callbacks past due."
          }
        },
        "required": [
          "requests",
          "ended",
          "open",
          "uncertain",
          "failed",
          "wrapUpRecords",
          "awaitingWrapUp",
          "openCallbacks",
          "overdueCallbacks"
        ],
        "additionalProperties": false
      },
      "CdrSummaryPage": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1,
            "description": "Version number."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "timezone": {
            "type": "string",
            "description": "IANA time zone, for example `Asia/Kolkata`."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was observed (ISO 8601)."
          },
          "consistency": {
            "type": "string",
            "const": "LIVE_PAGE",
            "description": "How current the data is: `LIVE_PAGE` means read live when the page was built."
          },
          "groupBy": {
            "type": "string",
            "enum": [
              "LEAD",
              "ACCOUNT"
            ],
            "description": "`LEAD` or `ACCOUNT` (grouped by a customer field)."
          },
          "accountFieldKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Customer field to group by when `groupBy` is `ACCOUNT`."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the period (ISO 8601), inclusive."
          },
          "to": {
            "type": "string",
            "format": "date-time",
            "description": "End of the period (ISO 8601), inclusive."
          },
          "timeBasis": {
            "default": "CALL_CREATED",
            "description": "Which call time the period filters on: when the call was created, when it ended, or any time it was active.",
            "type": "string",
            "enum": [
              "CALL_CREATED",
              "CALL_ENDED",
              "ACTIVE_DURING"
            ]
          },
          "matchedLeads": {
            "type": "integer",
            "minimum": 0,
            "description": "Leads matched to a group."
          },
          "totalGroups": {
            "type": "integer",
            "minimum": 0,
            "description": "Groups in the summary, across all pages."
          },
          "unmatchedLeads": {
            "type": "integer",
            "minimum": 0,
            "description": "Leads without a value in the grouping field."
          },
          "totals": {
            "description": "Totals across all groups.",
            "$ref": "#/components/schemas/CdrSummaryCounts"
          },
          "items": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CdrSummaryRow"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "version",
          "campaignId",
          "timezone",
          "observedAt",
          "consistency",
          "groupBy",
          "accountFieldKey",
          "from",
          "to",
          "timeBasis",
          "matchedLeads",
          "totalGroups",
          "unmatchedLeads",
          "totals",
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "CdrSummaryRow": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Stable machine key. Unlike the label, it never changes."
          },
          "identity": {
            "description": "The lead or account this row is for.",
            "$ref": "#/components/schemas/CdrCell"
          },
          "leadCount": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Number of lead records."
          },
          "counts": {
            "description": "Totals for this row.",
            "$ref": "#/components/schemas/CdrSummaryCounts"
          },
          "firstRequestedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was first requested (ISO 8601)."
          },
          "lastRequestedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was last requested (ISO 8601)."
          },
          "latestCallId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the latest call."
          },
          "latestLeadId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the latest lead."
          }
        },
        "required": [
          "key",
          "identity",
          "leadCount",
          "counts",
          "firstRequestedAt",
          "lastRequestedAt",
          "latestCallId",
          "latestLeadId"
        ],
        "additionalProperties": false
      },
      "CdrTemplate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call detail record template."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "ownerId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the owner."
          },
          "name": {
            "type": "string",
            "description": "Name of the call detail record template, as shown in the LMS."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PRIVATE",
              "PROCESS"
            ],
            "description": "Who can see it, from the values below."
          },
          "revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "definition": {
            "$ref": "#/components/schemas/CdrDefinition",
            "description": "What the report contains: columns, filters and time basis."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "canEdit": {
            "type": "boolean",
            "description": "Whether it can edit."
          }
        },
        "required": [
          "id",
          "processId",
          "ownerId",
          "name",
          "visibility",
          "revision",
          "definition",
          "updatedAt",
          "canEdit"
        ],
        "additionalProperties": false
      },
      "CdrTemplates": {
        "type": "object",
        "properties": {
          "items": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CdrTemplate"
            },
            "description": "The records in this response, in the documented order."
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "CdrValueType": {
        "type": "string",
        "enum": [
          "TEXT",
          "NUMBER",
          "BOOLEAN",
          "DATETIME",
          "DATE",
          "TEXT_LIST"
        ]
      },
      "ChangeFeedPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicEvent"
            },
            "description": "Events in feed order, oldest first."
          },
          "nextCursor": {
            "type": "string",
            "description": "Opaque cursor. Pass it as `cursor` on the next request, and store it only after you have processed this page."
          },
          "hasMore": {
            "type": "boolean",
            "description": "`true` when another page is already available."
          }
        },
        "required": [
          "data",
          "nextCursor",
          "hasMore"
        ],
        "additionalProperties": false,
        "description": "One page of the change feed."
      },
      "ClearLeadLockRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 100,
            "pattern": "^[A-Z][A-Z0-9_:-]*$",
            "description": "Your reason code, in upper case (for example `CRM_SYNC`). Kept in the lead's history."
          }
        },
        "required": [
          "reason"
        ],
        "additionalProperties": false
      },
      "CompleteHumanCall": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The call's `revision` from your last read; `409` if it changed since."
          },
          "outcome": {
            "description": "Overall outcome of the call.",
            "$ref": "#/components/schemas/HumanCallOutcome"
          },
          "dispositionKey": {
            "description": "Key of the campaign disposition (the detailed outcome agents pick).",
            "type": "string",
            "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
          },
          "dispositionRevision": {
            "description": "Revision of the campaign's disposition list you chose from; `409` if it changed.",
            "type": "integer",
            "minimum": 0
          },
          "customerFields": {
            "description": "Customer field values captured during the call.",
            "$ref": "#/components/schemas/SaveCustomerFieldValues"
          },
          "note": {
            "description": "Wrap-up note (up to 5,000 characters).",
            "type": "string",
            "maxLength": 5000
          },
          "followUpDueAt": {
            "description": "When to call back. Required when `outcome` is `FOLLOW_UP_SCHEDULED`, refused otherwise.",
            "type": "string",
            "format": "date-time"
          },
          "callback": {
            "description": "Callback reason and time zone. Required with `FOLLOW_UP_SCHEDULED`, refused otherwise.",
            "$ref": "#/components/schemas/HumanCallbackDetails"
          }
        },
        "required": [
          "expectedRevision",
          "outcome"
        ],
        "additionalProperties": false
      },
      "ContactEligibility": {
        "type": "object",
        "properties": {
          "contactId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the contact."
          },
          "reason": {
            "$ref": "#/components/schemas/ContactEligibilityReason",
            "description": "Why, in plain language."
          },
          "message": {
            "type": "string",
            "description": "Human-readable message. Do not branch on it; the wording may change."
          },
          "eligibleAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Eligible time (ISO 8601); `null` if not yet."
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "description": "Call attempts made so far."
          },
          "attemptsIn24Hours": {
            "type": "integer",
            "minimum": 0,
            "description": "Call attempts made in the last 24 hours."
          },
          "consent": {
            "type": "string",
            "enum": [
              "UNKNOWN",
              "GRANTED",
              "WITHDRAWN"
            ],
            "description": "Recorded consent to be called: `UNKNOWN`, `GRANTED` or `WITHDRAWN`."
          }
        },
        "required": [
          "contactId",
          "reason",
          "message",
          "eligibleAt",
          "attempts",
          "attemptsIn24Hours",
          "consent"
        ],
        "additionalProperties": false
      },
      "ContactEligibilityList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactEligibility"
            },
            "description": "The records in this response, in the documented order."
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "ContactEligibilityReason": {
        "type": "string",
        "enum": [
          "ELIGIBLE",
          "COHORT_PAUSED",
          "OUTSIDE_SCHEDULE",
          "CAMPAIGN_PAUSED",
          "CONTACT_INVALID",
          "LEAD_CLOSED",
          "SUPPRESSED",
          "CONSENT_REQUIRED",
          "CALL_OPEN",
          "ATTEMPT_LIMIT",
          "FREQUENCY_LIMIT",
          "CALLBACK_PENDING",
          "CALLBACK_ASSIGNED",
          "CALLBACK_CONTACT",
          "MANUAL_REDIAL_DISABLED",
          "RETRIES_DISABLED",
          "OUTCOME_UNRESOLVED",
          "INVALID_DESTINATION",
          "NO_AUTOMATIC_RETRY",
          "RETRY_COOLDOWN",
          "TECHNICAL_RETRY_LIMIT",
          "DAILY_PHONE_CAP",
          "MACHINE_RETRY_COOLDOWN"
        ]
      },
      "ContactPermission": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "UNKNOWN",
              "GRANTED",
              "WITHDRAWN"
            ],
            "description": "Current status of the contact permission."
          },
          "evidence": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the permission was recorded."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          }
        },
        "required": [
          "status",
          "evidence",
          "revision"
        ],
        "additionalProperties": false
      },
      "CorrectLeadActivityRequest": {
        "type": "object",
        "properties": {
          "activity": {
            "description": "The corrected activity, in full.",
            "$ref": "#/components/schemas/LeadActivityInput"
          },
          "correctionReason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Why you are correcting it; kept in the audit trail."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The activity's `revision` from your last read; `409` if it changed since."
          }
        },
        "required": [
          "activity",
          "correctionReason",
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "CreateAllocationRulesetRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the allocation ruleset, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          }
        },
        "required": [
          "name",
          "processId"
        ],
        "additionalProperties": false
      },
      "CreateCallBatchRequest": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "leadIds": {
            "minItems": 1,
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of the lead records."
          }
        },
        "required": [
          "campaignId",
          "leadIds"
        ],
        "additionalProperties": false
      },
      "CreateCampaignRequest": {
        "type": "object",
        "properties": {
          "description": {
            "default": "",
            "type": "string",
            "maxLength": 1000,
            "description": "Free-text description."
          },
          "endsAt": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it ends (ISO 8601); `null` if not yet."
          },
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 120,
            "description": "Name of the campaign, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "startsAt": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it starts (ISO 8601); `null` if not yet."
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "IANA time zone, for example `Asia/Kolkata`."
          }
        },
        "required": [
          "name",
          "processId",
          "timezone"
        ],
        "additionalProperties": false
      },
      "CreateLeadResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "boolean",
            "description": "`true` when a new lead was created (`201`); `false` when the person matched an existing lead (`200`)."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the new lead, or of the existing lead it matched."
          },
          "repeatEnquiry": {
            "description": "`true` when the request matched an existing lead and was recorded as a repeat enquiry.",
            "type": "boolean"
          }
        },
        "required": [
          "created",
          "leadId"
        ],
        "additionalProperties": false
      },
      "CreateMappingDraftRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the mapping draft, as shown in the LMS."
          },
          "rules": {
            "default": [],
            "maxItems": 500,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceFieldMappingRule"
            },
            "description": "Rules, checked in `priority` order; the first match wins."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source connection."
          }
        },
        "required": [
          "name",
          "sourceConnectionId"
        ],
        "additionalProperties": false
      },
      "CreateProcessRequest": {
        "type": "object",
        "properties": {
          "description": {
            "default": "",
            "type": "string",
            "maxLength": 1000,
            "description": "Free-text description."
          },
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 120,
            "description": "Name of the process, as shown in the LMS."
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "IANA time zone, for example `Asia/Kolkata`."
          }
        },
        "required": [
          "name",
          "timezone"
        ],
        "additionalProperties": false
      },
      "CreateRoutingRulesetRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the routing ruleset, as shown in the LMS."
          },
          "rules": {
            "default": [],
            "maxItems": 500,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceRoutingRule"
            },
            "description": "Rules, checked in `priority` order; the first match wins."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source connection."
          }
        },
        "required": [
          "name",
          "sourceConnectionId"
        ],
        "additionalProperties": false
      },
      "CreateSegmentationRulesetRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the segmentation ruleset, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          }
        },
        "required": [
          "name",
          "processId"
        ],
        "additionalProperties": false
      },
      "CreateSegmentRequest": {
        "type": "object",
        "properties": {
          "colorToken": {
            "$ref": "#/components/schemas/SegmentColorToken",
            "description": "Colour used to show it in the LMS."
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text description."
          },
          "displayOrder": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Position in lists; lower numbers come first."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the segment, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          }
        },
        "required": [
          "name",
          "processId"
        ],
        "additionalProperties": false
      },
      "CreateSelfLeadRequest": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign to create the lead in. It decides the process, pipeline and duplicate rules. Find IDs with List campaigns."
          },
          "city": {
            "description": "City, for example `Pune`.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "companyName": {
            "description": "Company or business name.",
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "contacts": {
            "default": [],
            "description": "Phone numbers, emails and other contacts. Give at least a name, a company or one phone, email or WhatsApp contact.",
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadContactInput"
            }
          },
          "country": {
            "description": "Country, for example `India`.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "customAttributes": {
            "default": {},
            "description": "Values for the campaign's customer fields, keyed by field key (see Get a lead's customer fields). Unknown keys are refused.",
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            }
          },
          "customerFormRevision": {
            "description": "Revision of the customer form your `customAttributes` were built against; if the form changed since, the request fails with `409`.",
            "type": "integer",
            "minimum": 0
          },
          "fullName": {
            "description": "The person's full name.",
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "inquirySummary": {
            "description": "What the person asked for, in their words or yours. Shown to agents.",
            "type": "string",
            "minLength": 1,
            "maxLength": 5000
          },
          "priority": {
            "default": "MEDIUM",
            "description": "How urgently to work the lead: `LOW`, `MEDIUM`, `HIGH` or `URGENT`. Responses and events report it as a rank from `1` (low) to `4` (urgent).",
            "$ref": "#/components/schemas/LeadPriority"
          },
          "productInterest": {
            "description": "Product or service the person is interested in, for example `Rooftop solar, 5 kW`.",
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "state": {
            "description": "State or region.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "campaignId"
        ],
        "additionalProperties": false
      },
      "CreateSourceConnectionRequest": {
        "type": "object",
        "properties": {
          "configuration": {
            "default": {},
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            },
            "description": "Settings specific to this kind of source."
          },
          "defaultCampaignId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the default campaign; `null` if none."
          },
          "externalAccountId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the external account; `null` if none."
          },
          "externalAccountName": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of the external account, as shown in the LMS."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the source connection, as shown in the LMS."
          },
          "secretReference": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "description": "Reference to a stored secret; the secret itself is never returned."
          },
          "sourceDefinitionKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Source type key, for example `meta_lead_ads` (see List source types)."
          }
        },
        "required": [
          "name",
          "sourceDefinitionKey"
        ],
        "additionalProperties": false
      },
      "CreateStageRequest": {
        "type": "object",
        "properties": {
          "displayOrder": {
            "type": "integer",
            "minimum": 0,
            "description": "Position in lists; lower numbers come first."
          },
          "isActive": {
            "default": true,
            "type": "boolean",
            "description": "Whether it is active."
          },
          "isInitial": {
            "default": false,
            "type": "boolean",
            "description": "Whether it is initial."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the stage, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "replaceInitial": {
            "type": "boolean",
            "const": true,
            "description": "Send `true` to make this the initial stage in place of the current one; otherwise a second initial stage is refused."
          },
          "semanticCategory": {
            "$ref": "#/components/schemas/SemanticStageCategory"
          }
        },
        "required": [
          "displayOrder",
          "name",
          "processId",
          "semanticCategory"
        ],
        "additionalProperties": false
      },
      "CreateTeamRequest": {
        "type": "object",
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text description."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the team, as shown in the LMS."
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "CustomerField": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$",
            "description": "Stable machine key. Unlike the label, it never changes."
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Field label shown to agents."
          },
          "type": {
            "description": "Kind of input, which decides the value type.",
            "$ref": "#/components/schemas/CustomerFieldType"
          },
          "section": {
            "default": "Customer details",
            "description": "Section heading the field appears under.",
            "type": "string",
            "maxLength": 80
          },
          "helpText": {
            "default": "",
            "description": "Help text shown under the field.",
            "type": "string",
            "maxLength": 300
          },
          "placeholder": {
            "default": "",
            "description": "Placeholder shown in the empty field.",
            "type": "string",
            "maxLength": 100
          },
          "required": {
            "default": false,
            "description": "Whether agents must fill it before saving.",
            "type": "boolean"
          },
          "editable": {
            "default": true,
            "description": "Whether agents can change it after it is set.",
            "type": "boolean"
          },
          "masked": {
            "default": false,
            "description": "Whether the value is hidden from members without permission to see it.",
            "type": "boolean"
          },
          "active": {
            "default": true,
            "description": "`false` once archived; archived fields cannot be written.",
            "type": "boolean"
          },
          "options": {
            "default": [],
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "description": "The value."
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "description": "Display label."
                }
              },
              "required": [
                "value",
                "label"
              ],
              "additionalProperties": false
            },
            "description": "Choices for a select field, in display order."
          }
        },
        "required": [
          "key",
          "label",
          "type",
          "section",
          "helpText",
          "placeholder",
          "required",
          "editable",
          "masked",
          "active",
          "options"
        ],
        "additionalProperties": false
      },
      "CustomerFieldInput": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$",
            "description": "Stable machine key. Unlike the label, it never changes."
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Field label shown to agents."
          },
          "type": {
            "description": "Kind of input, which decides the value type.",
            "$ref": "#/components/schemas/CustomerFieldType"
          },
          "section": {
            "default": "Customer details",
            "description": "Section heading the field appears under.",
            "type": "string",
            "maxLength": 80
          },
          "helpText": {
            "default": "",
            "description": "Help text shown under the field.",
            "type": "string",
            "maxLength": 300
          },
          "placeholder": {
            "default": "",
            "description": "Placeholder shown in the empty field.",
            "type": "string",
            "maxLength": 100
          },
          "required": {
            "default": false,
            "description": "Whether agents must fill it before saving.",
            "type": "boolean"
          },
          "editable": {
            "default": true,
            "description": "Whether agents can change it after it is set.",
            "type": "boolean"
          },
          "masked": {
            "default": false,
            "description": "Whether the value is hidden from members without permission to see it.",
            "type": "boolean"
          },
          "active": {
            "default": true,
            "description": "`false` once archived; archived fields cannot be written.",
            "type": "boolean"
          },
          "options": {
            "default": [],
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "description": "The value."
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "description": "Display label."
                }
              },
              "required": [
                "value",
                "label"
              ],
              "additionalProperties": false
            },
            "description": "Choices for a select field, in display order."
          }
        },
        "required": [
          "key",
          "label",
          "type"
        ],
        "additionalProperties": false
      },
      "CustomerFields": {
        "maxItems": 60,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/CustomerField"
        }
      },
      "CustomerFieldsInput": {
        "maxItems": 60,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/CustomerFieldInput"
        }
      },
      "CustomerFieldType": {
        "type": "string",
        "enum": [
          "TEXT",
          "TEXTAREA",
          "NUMBER",
          "DATE",
          "SELECT",
          "MULTI_SELECT",
          "CHECKBOX",
          "EMAIL"
        ]
      },
      "CustomerFieldValue": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 5000
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "type": "null"
          }
        ]
      },
      "CustomerFieldValues": {},
      "CustomerFieldValuesResponse": {
        "type": "object",
        "properties": {
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "leadName": {
            "description": "The lead's name, for display.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "maskedFields": {
            "default": [],
            "description": "Keys of fields whose values are hidden from the API key's acting member.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "form": {
            "description": "The campaign's customer form.",
            "$ref": "#/components/schemas/CampaignCustomerForm"
          },
          "values": {
            "type": "object",
            "additionalProperties": {},
            "description": "Current values keyed by field key."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The lead's `updatedAt`. Send it as `expectedUpdatedAt` when saving."
          }
        },
        "required": [
          "leadId",
          "maskedFields",
          "form",
          "values",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "DeleteCdrTemplate": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "DialerDecision": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When this pacing decision was made (ISO 8601)."
          },
          "reason": {
            "type": "string",
            "description": "Why the dialler chose this pacing, in plain language."
          },
          "slots": {
            "type": "integer",
            "minimum": 0,
            "description": "Calls the dialler may start now."
          },
          "effectiveCps": {
            "type": "number",
            "minimum": 0,
            "description": "Calls per second actually allowed now."
          },
          "recommendedCps": {
            "type": "number",
            "minimum": 0,
            "description": "Calls per second the model recommends."
          },
          "recommendedRatio": {
            "type": "number",
            "minimum": 0,
            "description": "Dial ratio the model recommends."
          },
          "sampleSize": {
            "type": "integer",
            "minimum": 0,
            "description": "Recent calls the recommendation is based on."
          },
          "answerRate": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "Share of recent calls answered (0–1); `null` without enough data."
          },
          "meanAnswerSeconds": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Average seconds until answer."
          },
          "meanTalkSeconds": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Average talk time, in seconds."
          },
          "meanWrapSeconds": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Average wrap-up time, in seconds."
          },
          "meanWaitSeconds": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Average seconds answered customers waited for an agent."
          },
          "waitingFailures": {
            "type": "integer",
            "minimum": 0,
            "description": "Answered calls dropped because no agent was free."
          },
          "scoredPredictions": {
            "default": 0,
            "description": "Past predictions checked against what happened.",
            "type": "integer",
            "minimum": 0
          },
          "predictionError": {
            "default": null,
            "description": "Average error of the model's predictions; `null` without enough data.",
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "baselineError": {
            "default": null,
            "description": "Average error of a simple baseline, for comparison.",
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "calibrationError": {
            "default": null,
            "description": "How far predicted answer rates were from actual ones.",
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "qualified": {
            "default": false,
            "description": "`true` once the model has beaten the baseline on enough calls to be trusted.",
            "type": "boolean"
          },
          "capacity": {
            "default": null,
            "description": "Telephony capacity when the decision was made.",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "observedAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When capacity was read."
                  },
                  "channelsInUse": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Lines in use."
                  },
                  "channelLimit": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Lines available in total."
                  },
                  "startsAvailable": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Calls that may still start this second; `null` if unknown."
                  },
                  "healthyRoutes": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Carrier routes working now."
                  },
                  "totalRoutes": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Carrier routes configured."
                  },
                  "connectionName": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Telephony connection name."
                  }
                },
                "required": [
                  "observedAt",
                  "channelsInUse",
                  "channelLimit",
                  "startsAvailable",
                  "healthyRoutes",
                  "totalRoutes",
                  "connectionName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "at",
          "reason",
          "slots",
          "effectiveCps",
          "recommendedCps",
          "recommendedRatio",
          "sampleSize",
          "answerRate",
          "meanAnswerSeconds",
          "meanTalkSeconds",
          "meanWrapSeconds",
          "meanWaitSeconds",
          "waitingFailures",
          "scoredPredictions",
          "predictionError",
          "baselineError",
          "calibrationError",
          "qualified",
          "capacity"
        ],
        "additionalProperties": false
      },
      "DialerPolicy": {
        "type": "object",
        "properties": {
          "agentIds": {
            "default": [],
            "description": "Members who dial in this campaign.",
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "agentMode": {
            "default": "MANUAL",
            "description": "`MANUAL` (agents choose whom to call) or `PROGRESSIVE` (LMS dials the next lead for each ready agent).",
            "type": "string",
            "enum": [
              "MANUAL",
              "PROGRESSIVE"
            ]
          },
          "intervalSeconds": {
            "default": 10,
            "description": "Seconds between progressive calls for one agent (5–300).",
            "type": "integer",
            "minimum": 5,
            "maximum": 300
          },
          "poolId": {
            "default": null,
            "description": "Number pool calls are placed from; `null` for the default.",
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "edgeGroup": {
            "default": null,
            "description": "Telephony edge group that carries the calls; `null` for the default.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ]
          },
          "running": {
            "default": false,
            "description": "Whether the dialler is placing calls now.",
            "type": "boolean"
          },
          "mode": {
            "default": "OBSERVE",
            "description": "Pacing control: `OBSERVE` (measure only), `RECOMMEND` (suggest pacing) or `AUTOMATIC` (adjust pacing itself).",
            "type": "string",
            "enum": [
              "OBSERVE",
              "RECOMMEND",
              "AUTOMATIC"
            ]
          },
          "cps": {
            "default": 1,
            "description": "Calls started per second at most (0.1–100).",
            "type": "number",
            "minimum": 0.1,
            "maximum": 100
          },
          "dialRatio": {
            "default": 1,
            "description": "Calls placed per ready agent (1–10). Above 1, some answered calls may wait for an agent.",
            "type": "number",
            "minimum": 1,
            "maximum": 10
          },
          "outstandingLimit": {
            "default": 10,
            "description": "Most calls ringing at once (1–1,000).",
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "priority": {
            "default": 1,
            "description": "Priority against other campaigns sharing lines; 1 is highest.",
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "waitingLimit": {
            "default": 0,
            "description": "Most answered customers allowed to wait for an agent (0–100).",
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "maxWaitSeconds": {
            "default": 10,
            "description": "Longest an answered customer waits for an agent before the call is dropped (1–60 seconds).",
            "type": "integer",
            "minimum": 1,
            "maximum": 60
          },
          "timezone": {
            "default": "Asia/Kolkata",
            "description": "IANA time zone the calling hours are in, for example `Asia/Kolkata`.",
            "type": "string",
            "maxLength": 100
          },
          "days": {
            "default": [
              1,
              2,
              3,
              4,
              5,
              6
            ],
            "description": "Days calls may be placed, `0` = Sunday … `6` = Saturday.",
            "minItems": 1,
            "maxItems": 7,
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 6
            }
          },
          "startMinute": {
            "default": 540,
            "description": "Start of calling hours, in minutes after midnight (`540` = 9:00).",
            "type": "integer",
            "minimum": 0,
            "maximum": 1439
          },
          "endMinute": {
            "default": 1080,
            "description": "End of calling hours, in minutes after midnight (`1080` = 18:00).",
            "type": "integer",
            "minimum": 1,
            "maximum": 1440
          },
          "weeklyWindows": {
            "description": "Per-day calling windows; when set they replace `days`, `startMinute` and `endMinute`.",
            "maxItems": 28,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 6,
                  "description": "Day, `0` = Sunday … `6` = Saturday."
                },
                "startMinute": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 1439,
                  "description": "Window start, minutes after midnight."
                },
                "endMinute": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 1440,
                  "description": "Window end, minutes after midnight."
                }
              },
              "required": [
                "day",
                "startMinute",
                "endMinute"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "agentIds",
          "agentMode",
          "intervalSeconds",
          "poolId",
          "edgeGroup",
          "running",
          "mode",
          "cps",
          "dialRatio",
          "outstandingLimit",
          "priority",
          "waitingLimit",
          "maxWaitSeconds",
          "timezone",
          "days",
          "startMinute",
          "endMinute"
        ],
        "additionalProperties": false
      },
      "DialerPolicyInput": {
        "type": "object",
        "properties": {
          "agentIds": {
            "default": [],
            "description": "Members who dial in this campaign.",
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "agentMode": {
            "default": "MANUAL",
            "description": "`MANUAL` (agents choose whom to call) or `PROGRESSIVE` (LMS dials the next lead for each ready agent).",
            "type": "string",
            "enum": [
              "MANUAL",
              "PROGRESSIVE"
            ]
          },
          "intervalSeconds": {
            "default": 10,
            "description": "Seconds between progressive calls for one agent (5–300).",
            "type": "integer",
            "minimum": 5,
            "maximum": 300
          },
          "poolId": {
            "default": null,
            "description": "Number pool calls are placed from; `null` for the default.",
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "edgeGroup": {
            "default": null,
            "description": "Telephony edge group that carries the calls; `null` for the default.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ]
          },
          "running": {
            "default": false,
            "description": "Whether the dialler is placing calls now.",
            "type": "boolean"
          },
          "mode": {
            "default": "OBSERVE",
            "description": "Pacing control: `OBSERVE` (measure only), `RECOMMEND` (suggest pacing) or `AUTOMATIC` (adjust pacing itself).",
            "type": "string",
            "enum": [
              "OBSERVE",
              "RECOMMEND",
              "AUTOMATIC"
            ]
          },
          "cps": {
            "default": 1,
            "description": "Calls started per second at most (0.1–100).",
            "type": "number",
            "minimum": 0.1,
            "maximum": 100
          },
          "dialRatio": {
            "default": 1,
            "description": "Calls placed per ready agent (1–10). Above 1, some answered calls may wait for an agent.",
            "type": "number",
            "minimum": 1,
            "maximum": 10
          },
          "outstandingLimit": {
            "default": 10,
            "description": "Most calls ringing at once (1–1,000).",
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "priority": {
            "default": 1,
            "description": "Priority against other campaigns sharing lines; 1 is highest.",
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "waitingLimit": {
            "default": 0,
            "description": "Most answered customers allowed to wait for an agent (0–100).",
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "maxWaitSeconds": {
            "default": 10,
            "description": "Longest an answered customer waits for an agent before the call is dropped (1–60 seconds).",
            "type": "integer",
            "minimum": 1,
            "maximum": 60
          },
          "timezone": {
            "default": "Asia/Kolkata",
            "description": "IANA time zone the calling hours are in, for example `Asia/Kolkata`.",
            "type": "string",
            "maxLength": 100
          },
          "days": {
            "default": [
              1,
              2,
              3,
              4,
              5,
              6
            ],
            "description": "Days calls may be placed, `0` = Sunday … `6` = Saturday.",
            "minItems": 1,
            "maxItems": 7,
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 6
            }
          },
          "startMinute": {
            "default": 540,
            "description": "Start of calling hours, in minutes after midnight (`540` = 9:00).",
            "type": "integer",
            "minimum": 0,
            "maximum": 1439
          },
          "endMinute": {
            "default": 1080,
            "description": "End of calling hours, in minutes after midnight (`1080` = 18:00).",
            "type": "integer",
            "minimum": 1,
            "maximum": 1440
          },
          "weeklyWindows": {
            "description": "Per-day calling windows; when set they replace `days`, `startMinute` and `endMinute`.",
            "maxItems": 28,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 6,
                  "description": "Day, `0` = Sunday … `6` = Saturday."
                },
                "startMinute": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 1439,
                  "description": "Window start, minutes after midnight."
                },
                "endMinute": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 1440,
                  "description": "Window end, minutes after midnight."
                }
              },
              "required": [
                "day",
                "startMinute",
                "endMinute"
              ],
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      },
      "DialerStatus": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign ID."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Policy revision; send it as `expectedRevision` when saving."
          },
          "policy": {
            "description": "Current dialler policy.",
            "$ref": "#/components/schemas/DialerPolicy"
          },
          "decision": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DialerDecision"
              },
              {
                "type": "null"
              }
            ],
            "description": "Latest pacing decision; `null` before the first one."
          }
        },
        "required": [
          "campaignId",
          "revision",
          "policy",
          "decision"
        ],
        "additionalProperties": false
      },
      "ErrorEnvelope": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "pattern": "^[A-Z][A-Z0-9_]+$",
                "description": "Machine-readable code. Branch on this, not on the label."
              },
              "message": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500,
                "description": "Human-readable message. Do not branch on it; the wording may change."
              },
              "requestId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "ID of the request."
              },
              "details": {
                "type": "object",
                "additionalProperties": {},
                "description": "Extra context for some codes, for example `currentRevision` on `STALE_REVISION`."
              }
            },
            "required": [
              "code",
              "message",
              "requestId"
            ],
            "additionalProperties": false,
            "description": "What went wrong."
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "FollowupCreatedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "followup.created",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "followUp": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Follow-up ID."
                  },
                  "dueAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the follow-up is due (ISO 8601)."
                  },
                  "channel": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "phone",
                          "email",
                          "whatsapp",
                          "sms",
                          "meeting",
                          "other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "How the follow-up is planned; `null` for follow-ups booked from a call."
                  },
                  "ownerUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "User ID of the member who should do it; `null` if unassigned."
                  }
                },
                "required": [
                  "id",
                  "dueAt",
                  "channel",
                  "ownerUserId"
                ],
                "additionalProperties": false,
                "description": "The follow-up."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "followUp",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "FollowupDueEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "followup.due",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "followUp": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Follow-up ID."
                  },
                  "dueAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the follow-up is due (ISO 8601)."
                  },
                  "channel": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "phone",
                          "email",
                          "whatsapp",
                          "sms",
                          "meeting",
                          "other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "How the follow-up is planned; `null` for follow-ups booked from a call."
                  },
                  "ownerUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "User ID of the member who should do it; `null` if unassigned."
                  }
                },
                "required": [
                  "id",
                  "dueAt",
                  "channel",
                  "ownerUserId"
                ],
                "additionalProperties": false,
                "description": "The follow-up."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "followUp",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "HumanAgentStatus": {
        "type": "object",
        "properties": {
          "campaigns": {
            "default": [],
            "description": "Campaigns the member can call in.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "campaignId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the campaign."
                },
                "campaignName": {
                  "type": "string",
                  "description": "Campaign name."
                },
                "running": {
                  "type": "boolean",
                  "description": "Whether calling is running in the campaign."
                }
              },
              "required": [
                "campaignId",
                "campaignName",
                "running"
              ],
              "additionalProperties": false
            }
          },
          "assignment": {
            "default": null,
            "description": "The campaign the member is assigned to dial now; `null` if none.",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "campaignId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "ID of the campaign."
                  },
                  "campaignName": {
                    "type": "string",
                    "description": "Campaign name."
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "MANUAL",
                      "PROGRESSIVE"
                    ],
                    "description": "`MANUAL` (agent picks whom to call) or `PROGRESSIVE` (LMS dials the next lead)."
                  },
                  "running": {
                    "type": "boolean",
                    "description": "Whether calling is running."
                  }
                },
                "required": [
                  "campaignId",
                  "campaignName",
                  "mode",
                  "running"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "session": {
            "default": null,
            "description": "The member's calling session; `null` when signed out of calling.",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "ID of the session."
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "READY",
                      "PAUSED",
                      "ON_CALL",
                      "WRAP_UP",
                      "OFFLINE"
                    ],
                    "description": "`READY`, `PAUSED`, `ON_CALL`, `WRAP_UP` or `OFFLINE`."
                  },
                  "availability": {
                    "default": "PAUSED",
                    "description": "What the agent chose: `READY` or `PAUSED`.",
                    "type": "string",
                    "enum": [
                      "READY",
                      "PAUSED"
                    ]
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "MANUAL",
                      "PROGRESSIVE"
                    ],
                    "description": "`MANUAL` or `PROGRESSIVE` dialling."
                  },
                  "strategy": {
                    "default": "PAIRED",
                    "description": "`PAIRED` (agent's phone rings first) or `CUSTOMER_FIRST` (customer is dialled first).",
                    "type": "string",
                    "enum": [
                      "PAIRED",
                      "CUSTOMER_FIRST"
                    ]
                  },
                  "campaignId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "ID of the campaign; `null` if none."
                  },
                  "nextCallAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When the next progressive call is due; `null` if none."
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the session lapses without a heartbeat."
                  },
                  "intervalSeconds": {
                    "type": "integer",
                    "description": "Seconds between progressive calls."
                  },
                  "revision": {
                    "type": "integer",
                    "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
                  },
                  "pauseReason": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Why the session is paused, in plain language."
                  },
                  "breakReasonKey": {
                    "default": null,
                    "description": "Key of the break reason the agent chose.",
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "breakReasonLabel": {
                    "default": null,
                    "description": "Name of that break reason.",
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "state",
                  "availability",
                  "mode",
                  "strategy",
                  "campaignId",
                  "nextCallAt",
                  "expiresAt",
                  "intervalSeconds",
                  "revision",
                  "pauseReason",
                  "breakReasonKey",
                  "breakReasonLabel"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "available": {
            "type": "boolean",
            "description": "Whether the member can take calls now."
          },
          "deviceType": {
            "default": null,
            "description": "`BROWSER` or `SIP_PHONE`; `null` without a device.",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "BROWSER",
                  "SIP_PHONE"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "browserSessionId": {
            "default": null,
            "description": "Browser phone session, when using the browser.",
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "browserRegistered": {
            "default": false,
            "description": "Whether the browser phone is registered and can ring.",
            "type": "boolean"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the member cannot call, in plain language; `null` when they can."
          },
          "endpointLabel": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of the phone the member uses."
          },
          "streamHealthy": {
            "type": "boolean",
            "description": "Whether live telephony updates are flowing; when `false`, states may lag."
          },
          "currentCall": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HumanCall"
              },
              {
                "type": "null"
              }
            ],
            "description": "The live call; `null` when not on a call."
          },
          "controlCall": {
            "default": null,
            "description": "A transfer or supervisor call in progress; `null` if none.",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "callId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "ID of the call."
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "TRANSFER",
                      "SUPERVISOR"
                    ],
                    "description": "`TRANSFER` or `SUPERVISOR`."
                  }
                },
                "required": [
                  "callId",
                  "kind"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "campaigns",
          "assignment",
          "session",
          "available",
          "deviceType",
          "browserSessionId",
          "browserRegistered",
          "reason",
          "endpointLabel",
          "streamHealthy",
          "currentCall",
          "controlCall"
        ],
        "additionalProperties": false
      },
      "HumanCall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the human call."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead the call is about."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign the call belongs to."
          },
          "contactId": {
            "type": "string",
            "format": "uuid",
            "description": "Phone contact that was dialled."
          },
          "agentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Agent on the call; `null` if none."
          },
          "externalCallId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Telephony provider's call ID."
          },
          "execution": {
            "default": null,
            "description": "Telephony execution of the call; `null` before it was placed.",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "attemptId": {
                    "type": "string",
                    "description": "Telephony attempt ID."
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Execution revision."
                  },
                  "code": {
                    "type": "string",
                    "description": "Telephony status code."
                  },
                  "customerDialed": {
                    "type": "string",
                    "enum": [
                      "UNKNOWN",
                      "CONFIRMED",
                      "NOT_DIALED"
                    ],
                    "description": "Whether the customer's number was dialled: `CONFIRMED`, `NOT_DIALED` or `UNKNOWN` (telephony has not said yet)."
                  }
                },
                "required": [
                  "attemptId",
                  "revision",
                  "code",
                  "customerDialed"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "$ref": "#/components/schemas/HumanCallState",
            "description": "Current state of the human call."
          },
          "businessState": {
            "type": "string",
            "enum": [
              "OPEN",
              "WRAP_UP",
              "DONE"
            ],
            "description": "Where the call is in the agent's work: `OPEN` (in progress), `WRAP_UP` (outcome not saved yet) or `DONE`."
          },
          "classification": {
            "type": "string",
            "description": "Telephony classification of how the call ended, for example `ANSWERED` or `NO_ANSWER`."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "connectedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the customer answered; `null` if never."
          },
          "endedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the call ended; `null` while live."
          },
          "outcome": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HumanCallOutcome"
              },
              {
                "type": "null"
              }
            ],
            "description": "Outcome the agent saved; `null` until wrap-up."
          },
          "dispositionKey": {
            "default": null,
            "description": "Key of the campaign disposition the agent chose; `null` until wrap-up.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "dispositionLabel": {
            "default": null,
            "description": "Name of that disposition, as agents see it.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Agent's note from wrap-up."
          },
          "followUpScheduledAt": {
            "default": null,
            "description": "When a follow-up was booked for; `null` if none.",
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Machine-readable reason the call failed; `null` unless it failed."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "recordingState": {
            "type": "string",
            "enum": [
              "NOT_AVAILABLE",
              "PROCESSING",
              "AVAILABLE",
              "FAILED"
            ],
            "description": "`NOT_AVAILABLE`, `PROCESSING`, `AVAILABLE` (download with Recordings) or `FAILED`."
          },
          "hangupPending": {
            "type": "boolean",
            "description": "`true` while a hang-up request is being carried out."
          },
          "wrapUpAutoClosed": {
            "default": false,
            "description": "`true` when LMS closed an abandoned wrap-up with the campaign's fallback outcome.",
            "type": "boolean"
          },
          "earlyMedia": {
            "default": false,
            "description": "`true` when the agent's phone joined first and heard ringback before the customer answered.",
            "type": "boolean"
          },
          "answeringMachine": {
            "default": null,
            "description": "Answering-machine detection: `HUNG_UP` (ended automatically), `CONNECTED` (put through anyway) or `DETECTED`; `null` if none.",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "HUNG_UP",
                  "CONNECTED",
                  "DETECTED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "callerNumber": {
            "default": null,
            "description": "Caller ID shown to the customer, masked unless the full number is known.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "direction": {
            "default": "OUTBOUND",
            "description": "`OUTBOUND` (agent called) or `INBOUND` (customer called the IVR).",
            "type": "string",
            "enum": [
              "OUTBOUND",
              "INBOUND"
            ]
          }
        },
        "required": [
          "id",
          "leadId",
          "campaignId",
          "contactId",
          "agentId",
          "externalCallId",
          "execution",
          "state",
          "businessState",
          "classification",
          "createdAt",
          "connectedAt",
          "endedAt",
          "outcome",
          "dispositionKey",
          "dispositionLabel",
          "note",
          "followUpScheduledAt",
          "errorCode",
          "revision",
          "recordingState",
          "hangupPending",
          "wrapUpAutoClosed",
          "earlyMedia",
          "answeringMachine",
          "callerNumber",
          "direction"
        ],
        "additionalProperties": false
      },
      "HumanCallbackDetails": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 1000,
            "description": "Why the customer wants a callback (3–1,000 characters)."
          },
          "timezone": {
            "type": "string",
            "maxLength": 100,
            "description": "Customer's IANA time zone, for example `Asia/Kolkata`."
          }
        },
        "required": [
          "reason",
          "timezone"
        ],
        "additionalProperties": false
      },
      "HumanCallHistory": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HumanCall"
            },
            "description": "The records in this response, in the documented order."
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "HumanCallingCampaign": {
        "type": "object",
        "properties": {
          "contactPolicy": {
            "description": "How often and when leads may be called.",
            "$ref": "#/components/schemas/HumanContactPolicyInput"
          },
          "dispositions": {
            "description": "Outcomes agents pick from at wrap-up.",
            "$ref": "#/components/schemas/CampaignDispositionsInput"
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether it is turned on."
          },
          "purpose": {
            "type": "string",
            "enum": [
              "SERVICE_TRANSACTIONAL",
              "PROMOTIONAL"
            ],
            "description": "`SERVICE_TRANSACTIONAL` or `PROMOTIONAL`; promotional calls follow stricter consent rules."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "enabled",
          "purpose",
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "HumanCallingCampaignResponse": {
        "type": "object",
        "properties": {
          "contactPolicy": {
            "description": "How often and when leads may be called.",
            "$ref": "#/components/schemas/HumanContactPolicy"
          },
          "dispositions": {
            "default": [
              {
                "key": "CONNECTED",
                "label": "Connected",
                "outcome": "CONNECTED",
                "active": true,
                "requiresNote": false
              },
              {
                "key": "NO_ANSWER",
                "label": "No answer",
                "outcome": "NO_ANSWER",
                "active": true,
                "requiresNote": false
              },
              {
                "key": "BUSY",
                "label": "Busy",
                "outcome": "BUSY",
                "active": true,
                "requiresNote": false
              },
              {
                "key": "INVALID_CONTACT",
                "label": "Invalid number",
                "outcome": "INVALID_CONTACT",
                "active": true,
                "requiresNote": false
              },
              {
                "key": "LEFT_MESSAGE",
                "label": "Left a message",
                "outcome": "LEFT_MESSAGE",
                "active": true,
                "requiresNote": false
              },
              {
                "key": "FOLLOW_UP_SCHEDULED",
                "label": "Follow-up agreed",
                "outcome": "FOLLOW_UP_SCHEDULED",
                "active": true,
                "requiresNote": false
              },
              {
                "key": "OTHER",
                "label": "Other",
                "outcome": "OTHER",
                "active": true,
                "requiresNote": false
              },
              {
                "key": "DO_NOT_CALL",
                "label": "Do not call",
                "outcome": "DO_NOT_CALL",
                "active": true,
                "requiresNote": true
              }
            ],
            "description": "Outcomes agents pick from at wrap-up.",
            "$ref": "#/components/schemas/CampaignDispositions"
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign ID."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether human calling is on for the campaign."
          },
          "purpose": {
            "type": "string",
            "enum": [
              "SERVICE_TRANSACTIONAL",
              "PROMOTIONAL"
            ],
            "description": "`SERVICE_TRANSACTIONAL` or `PROMOTIONAL`; promotional calls follow stricter consent rules."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision; send it as `expectedRevision` when saving."
          }
        },
        "required": [
          "contactPolicy",
          "dispositions",
          "campaignId",
          "enabled",
          "purpose",
          "revision"
        ],
        "additionalProperties": false
      },
      "HumanCallOutcome": {
        "type": "string",
        "enum": [
          "CONNECTED",
          "NO_ANSWER",
          "BUSY",
          "INVALID_CONTACT",
          "LEFT_MESSAGE",
          "FOLLOW_UP_SCHEDULED",
          "OTHER",
          "DO_NOT_CALL"
        ]
      },
      "HumanCallState": {
        "type": "string",
        "enum": [
          "REQUESTED",
          "QUEUED",
          "DISPATCHED",
          "AGENT_CONNECTING",
          "CUSTOMER_DIALING",
          "RINGING",
          "MEDIA_ANSWERED",
          "SCREENING",
          "HUMAN_CONFIRMED",
          "BRIDGED",
          "ENDING",
          "COMPLETED",
          "FAILED",
          "CANCELLED",
          "UNCERTAIN"
        ]
      },
      "HumanCallWrapUpHistory": {
        "type": "object",
        "properties": {
          "callId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call."
          },
          "snapshot": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HumanCallWrapUpSnapshot"
              },
              {
                "type": "null"
              }
            ],
            "description": "Saved wrap-up; `null` for calls without one."
          }
        },
        "required": [
          "callId",
          "snapshot"
        ],
        "additionalProperties": false
      },
      "HumanCallWrapUpSnapshot": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1,
            "description": "Snapshot format version."
          },
          "callId": {
            "type": "string",
            "format": "uuid",
            "description": "Call ID."
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When wrap-up was saved (ISO 8601)."
          },
          "completedBy": {
            "type": "string",
            "format": "uuid",
            "description": "Agent who saved it."
          },
          "dispositionRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision of the disposition list used."
          },
          "dispositionPath": {
            "minItems": 1,
            "maxItems": 4,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignDisposition"
            },
            "description": "Chosen disposition with its parents, top level first."
          },
          "customer": {
            "description": "Customer field values as saved.",
            "$ref": "#/components/schemas/CustomerFieldValuesResponse"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Wrap-up note."
          },
          "callback": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 1000,
                    "description": "Why the customer wants a callback (3–1,000 characters)."
                  },
                  "timezone": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Customer's IANA time zone, for example `Asia/Kolkata`."
                  },
                  "dueAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the callback is due."
                  },
                  "contactId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Number to call back."
                  },
                  "ownerId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Agent who owns the callback."
                  }
                },
                "required": [
                  "reason",
                  "timezone",
                  "dueAt",
                  "contactId",
                  "ownerId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Booked callback, if any."
          },
          "autoClosed": {
            "description": "`true` when LMS closed an abandoned wrap-up with the campaign's fallback outcome.",
            "type": "boolean"
          }
        },
        "required": [
          "version",
          "callId",
          "completedAt",
          "completedBy",
          "dispositionRevision",
          "dispositionPath",
          "customer",
          "note",
          "callback"
        ],
        "additionalProperties": false
      },
      "HumanContactPolicy": {
        "type": "object",
        "properties": {
          "automaticRetries": {
            "default": false,
            "description": "Retry unanswered calls automatically.",
            "type": "boolean"
          },
          "allowManualRedial": {
            "default": true,
            "description": "Let agents redial a number by hand.",
            "type": "boolean"
          },
          "requireConsent": {
            "default": false,
            "description": "Only call numbers with recorded consent.",
            "type": "boolean"
          },
          "maxAttempts": {
            "description": "Most calls to one number in total.",
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "maxAttemptsPer24Hours": {
            "description": "Most calls to one number in any 24 hours.",
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "busyDelayMinutes": {
            "description": "Minutes before retrying a busy number.",
            "type": "integer",
            "minimum": 5,
            "maximum": 10080
          },
          "noAnswerDelayMinutes": {
            "description": "Minutes before retrying an unanswered number.",
            "type": "integer",
            "minimum": 5,
            "maximum": 10080
          },
          "technicalDelayMinutes": {
            "description": "Minutes before retrying after a network failure.",
            "type": "integer",
            "minimum": 5,
            "maximum": 10080
          },
          "maxTechnicalRetriesPer24Hours": {
            "description": "Most retries after network failures in any 24 hours.",
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          }
        },
        "required": [
          "automaticRetries",
          "allowManualRedial",
          "requireConsent"
        ],
        "additionalProperties": false
      },
      "HumanContactPolicyInput": {
        "type": "object",
        "properties": {
          "automaticRetries": {
            "default": false,
            "description": "Retry unanswered calls automatically.",
            "type": "boolean"
          },
          "allowManualRedial": {
            "default": true,
            "description": "Let agents redial a number by hand.",
            "type": "boolean"
          },
          "requireConsent": {
            "default": false,
            "description": "Only call numbers with recorded consent.",
            "type": "boolean"
          },
          "maxAttempts": {
            "description": "Most calls to one number in total.",
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "maxAttemptsPer24Hours": {
            "description": "Most calls to one number in any 24 hours.",
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "busyDelayMinutes": {
            "description": "Minutes before retrying a busy number.",
            "type": "integer",
            "minimum": 5,
            "maximum": 10080
          },
          "noAnswerDelayMinutes": {
            "description": "Minutes before retrying an unanswered number.",
            "type": "integer",
            "minimum": 5,
            "maximum": 10080
          },
          "technicalDelayMinutes": {
            "description": "Minutes before retrying after a network failure.",
            "type": "integer",
            "minimum": 5,
            "maximum": 10080
          },
          "maxTechnicalRetriesPer24Hours": {
            "description": "Most retries after network failures in any 24 hours.",
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          }
        },
        "additionalProperties": false
      },
      "HumanFollowUp": {
        "type": "object",
        "properties": {
          "callId": {
            "type": "string",
            "format": "uuid",
            "description": "Call the follow-up came from."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead to follow up."
          },
          "leadName": {
            "default": null,
            "description": "Lead's name.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Agent's note."
          },
          "dueAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it is due (ISO 8601)."
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "DONE",
              "CANCELLED"
            ],
            "description": "`OPEN`, `DONE` or `CANCELLED`."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision; send it as `expectedRevision` to change the follow-up."
          }
        },
        "required": [
          "callId",
          "leadId",
          "leadName",
          "note",
          "dueAt",
          "status",
          "revision"
        ],
        "additionalProperties": false
      },
      "HumanFollowUps": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HumanFollowUp"
            },
            "description": "Follow-ups on this page, soonest first."
          },
          "nextOffset": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `offset` for the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextOffset"
        ],
        "additionalProperties": false
      },
      "IngestionBatchDetail": {
        "type": "object",
        "properties": {
          "fileName": {
            "description": "File name, as uploaded."
          },
          "acceptedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of accepted records."
          },
          "attemptCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of attempt records."
          },
          "batchId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the batch."
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was completed (ISO 8601); `null` if not yet."
          },
          "duplicateCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of duplicate records."
          },
          "failedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of failed records."
          },
          "intakeMode": {
            "type": "string",
            "description": "How leads arrive: pushed by the sender or polled by LMS."
          },
          "lastFailureCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Code of the most recent failure; `null` if none."
          },
          "lastFailureSummary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Plain-language summary of the most recent failure; `null` if none."
          },
          "needsMappingCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of needs mapping records."
          },
          "needsRoutingCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of needs routing records."
          },
          "receivedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of received records."
          },
          "rejectedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of rejected records."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source connection."
          },
          "sourceConnectionName": {
            "type": "string",
            "description": "Name of the source connection, as shown in the LMS."
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was started (ISO 8601)."
          },
          "status": {
            "type": "string",
            "description": "Current status of the ingestion batch."
          },
          "attempts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "attemptNumber": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "outcome": {
                  "type": "string",
                  "description": "How the attempt ended: `COMPLETED`, `PARTIAL` or a failure outcome."
                },
                "failureCode": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "safeErrorSummary": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Plain-language error with personal data removed; `null` on success."
                },
                "durationMs": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Duration, in milliseconds."
                },
                "completedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When it was completed (ISO 8601)."
                }
              },
              "required": [
                "attemptNumber",
                "outcome",
                "failureCode",
                "safeErrorSummary",
                "durationMs",
                "completedAt"
              ],
              "additionalProperties": false
            },
            "description": "Processing attempts, newest first."
          },
          "sourceRecordIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Source records the batch produced."
          }
        },
        "required": [
          "fileName",
          "acceptedCount",
          "attemptCount",
          "batchId",
          "completedAt",
          "duplicateCount",
          "failedCount",
          "intakeMode",
          "lastFailureCode",
          "lastFailureSummary",
          "needsMappingCount",
          "needsRoutingCount",
          "receivedCount",
          "rejectedCount",
          "sourceConnectionId",
          "sourceConnectionName",
          "startedAt",
          "status",
          "attempts",
          "sourceRecordIds"
        ],
        "additionalProperties": false
      },
      "IngestionBatchResponse": {
        "type": "object",
        "properties": {
          "fileName": {
            "description": "File name, as uploaded."
          },
          "acceptedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of accepted records."
          },
          "attemptCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of attempt records."
          },
          "batchId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the batch."
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was completed (ISO 8601); `null` if not yet."
          },
          "duplicateCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of duplicate records."
          },
          "failedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of failed records."
          },
          "intakeMode": {
            "type": "string",
            "description": "How leads arrive: pushed by the sender or polled by LMS."
          },
          "lastFailureCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Code of the most recent failure; `null` if none."
          },
          "lastFailureSummary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Plain-language summary of the most recent failure; `null` if none."
          },
          "needsMappingCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of needs mapping records."
          },
          "needsRoutingCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of needs routing records."
          },
          "receivedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of received records."
          },
          "rejectedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of rejected records."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source connection."
          },
          "sourceConnectionName": {
            "type": "string",
            "description": "Name of the source connection, as shown in the LMS."
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was started (ISO 8601)."
          },
          "status": {
            "type": "string",
            "description": "Current status of the ingestion batch."
          }
        },
        "required": [
          "fileName",
          "acceptedCount",
          "attemptCount",
          "batchId",
          "completedAt",
          "duplicateCount",
          "failedCount",
          "intakeMode",
          "lastFailureCode",
          "lastFailureSummary",
          "needsMappingCount",
          "needsRoutingCount",
          "receivedCount",
          "rejectedCount",
          "sourceConnectionId",
          "sourceConnectionName",
          "startedAt",
          "status"
        ],
        "additionalProperties": false
      },
      "IntegrationGrants": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "API key ID or environment integration ID."
          },
          "kind": {
            "type": "string",
            "enum": [
              "API_KEY",
              "ENVIRONMENT"
            ],
            "description": "`API_KEY` for tenant-managed keys (`lms_…`), `ENVIRONMENT` for legacy credentials configured on the server."
          },
          "scopes": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ApiKeyScope"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Scopes of an API key; `null` for environment credentials."
          },
          "sourceIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Sources this credential may submit to."
          },
          "recordingCampaignIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaigns whose call recordings this credential may download."
          },
          "operations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Workspace operations granted, as `METHOD /path` relative to `/v1/tenants/{tenantSlug}`. Path parameters are written `:leadId` here (the route catalogue form); the reference writes the same path `/lms/leads/{leadId}`."
          },
          "eventFeed": {
            "type": "boolean",
            "description": "Whether the change feed is available."
          }
        },
        "required": [
          "id",
          "kind",
          "scopes",
          "sourceIds",
          "recordingCampaignIds",
          "operations",
          "eventFeed"
        ],
        "additionalProperties": false,
        "description": "What the calling credential is allowed to do."
      },
      "JsonValue": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JsonValue"
            }
          },
          {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            }
          }
        ]
      },
      "LeadAcquisitionResponse": {
        "type": "object",
        "properties": {
          "channel": {
            "type": "string",
            "description": "Kind of source, for example `META`, `GOOGLE` or `WEBSITE`."
          },
          "clickId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ad click ID (for example `gclid` or `fbclid`), if captured."
          },
          "externalAccountId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ad account ID in the sending system."
          },
          "externalAccountName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ad account name in the sending system."
          },
          "externalAdGroupId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ad set or ad group ID."
          },
          "externalAdGroupName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ad set or ad group name."
          },
          "externalAdId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ad ID."
          },
          "externalAdName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ad name."
          },
          "externalCampaignId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ad campaign ID in the sending system."
          },
          "externalCampaignName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ad campaign name in the sending system."
          },
          "externalFormId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Lead form ID in the sending system."
          },
          "externalFormName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Lead form name in the sending system."
          },
          "landingPage": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "URL of the page where the form was filled in."
          },
          "platformReceivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When LMS received the enquiry (ISO 8601)."
          },
          "provider": {
            "type": "string",
            "description": "System that sent the lead, for example `meta` or `partner_api`."
          },
          "providerSubmittedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the person submitted the form, per the sending system."
          },
          "referrer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Page that sent the visitor to the landing page."
          },
          "sourceDefinitionKey": {
            "type": "string",
            "description": "Source type key, for example `meta_lead_ads`."
          },
          "utmCampaign": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`utm_campaign` value from the landing page URL."
          },
          "utmContent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`utm_content` value."
          },
          "utmMedium": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`utm_medium` value."
          },
          "utmSource": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`utm_source` value."
          },
          "utmTerm": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`utm_term` value."
          }
        },
        "required": [
          "channel",
          "clickId",
          "externalAccountId",
          "externalAccountName",
          "externalAdGroupId",
          "externalAdGroupName",
          "externalAdId",
          "externalAdName",
          "externalCampaignId",
          "externalCampaignName",
          "externalFormId",
          "externalFormName",
          "landingPage",
          "platformReceivedAt",
          "provider",
          "providerSubmittedAt",
          "referrer",
          "sourceDefinitionKey",
          "utmCampaign",
          "utmContent",
          "utmMedium",
          "utmSource",
          "utmTerm"
        ],
        "additionalProperties": false
      },
      "LeadActivityChannel": {
        "type": "string",
        "enum": [
          "PHONE",
          "EMAIL",
          "WHATSAPP",
          "SMS",
          "MEETING",
          "OTHER"
        ]
      },
      "LeadActivityDirection": {
        "type": "string",
        "enum": [
          "INBOUND",
          "OUTBOUND"
        ]
      },
      "LeadActivityInput": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "activityType": {
                "type": "string",
                "const": "CONTACT",
                "description": "`CONTACT`: a call, message or meeting with the person."
              },
              "channel": {
                "description": "How contact was made.",
                "$ref": "#/components/schemas/LeadActivityChannel"
              },
              "contactId": {
                "description": "Which of the lead's contacts was used, if known.",
                "type": "string",
                "format": "uuid"
              },
              "direction": {
                "description": "`OUTBOUND` if you reached out, `INBOUND` if they did.",
                "$ref": "#/components/schemas/LeadActivityDirection"
              },
              "note": {
                "description": "Free-text note (up to 10,000 characters).",
                "type": "string",
                "minLength": 1,
                "maxLength": 10000
              },
              "occurredAt": {
                "type": "string",
                "format": "date-time",
                "description": "When it happened (ISO 8601, with offset)."
              },
              "outcome": {
                "description": "What happened, for example `CONNECTED`, `NO_ANSWER` or `LEFT_MESSAGE`.",
                "$ref": "#/components/schemas/LeadActivityOutcome"
              }
            },
            "required": [
              "activityType",
              "channel",
              "direction",
              "occurredAt",
              "outcome"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "activityType": {
                "type": "string",
                "const": "NOTE",
                "description": "`NOTE`: a note on the lead."
              },
              "note": {
                "type": "string",
                "minLength": 1,
                "maxLength": 10000,
                "description": "The note (up to 10,000 characters)."
              },
              "occurredAt": {
                "type": "string",
                "format": "date-time",
                "description": "When it happened (ISO 8601, with offset)."
              }
            },
            "required": [
              "activityType",
              "note",
              "occurredAt"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "activityType": {
                "type": "string",
                "const": "FOLLOW_UP",
                "description": "`FOLLOW_UP`: a reminder to contact the person later."
              },
              "channel": {
                "description": "How you plan to follow up.",
                "$ref": "#/components/schemas/LeadActivityChannel"
              },
              "contactId": {
                "description": "Which of the lead's contacts was used, if known.",
                "type": "string",
                "format": "uuid"
              },
              "dueAt": {
                "type": "string",
                "format": "date-time",
                "description": "When the follow-up is due (ISO 8601). Raises `followup.created`, then `followup.due`."
              },
              "note": {
                "description": "Free-text note (up to 10,000 characters).",
                "type": "string",
                "minLength": 1,
                "maxLength": 10000
              },
              "occurredAt": {
                "type": "string",
                "format": "date-time",
                "description": "When it happened (ISO 8601, with offset)."
              }
            },
            "required": [
              "activityType",
              "dueAt",
              "occurredAt"
            ],
            "additionalProperties": false
          }
        ]
      },
      "LeadActivityOutcome": {
        "type": "string",
        "enum": [
          "CONNECTED",
          "NO_ANSWER",
          "BUSY",
          "INVALID_CONTACT",
          "LEFT_MESSAGE",
          "REPLIED",
          "BOUNCED_FAILED",
          "FOLLOW_UP_SCHEDULED",
          "OTHER"
        ]
      },
      "LeadActivityPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadActivityResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "LeadActivityQuery": {
        "type": "object",
        "properties": {
          "activityTypes": {
            "description": "Only these kinds: `CONTACT`, `NOTE`, `FOLLOW_UP`.",
            "minItems": 1,
            "maxItems": 3,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadActivityType"
            }
          },
          "channels": {
            "description": "Only activities on these channels.",
            "minItems": 1,
            "maxItems": 6,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadActivityChannel"
            }
          },
          "cursor": {
            "description": "Cursor from the previous page's `nextCursor`; leave out for the first page.",
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "includeVoided": {
            "default": false,
            "description": "Include voided activities (left out by default).",
            "type": "boolean"
          },
          "limit": {
            "default": 50,
            "description": "Activities per page (1–100).",
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "occurredFrom": {
            "description": "Only activities that happened at or after this time (ISO 8601).",
            "type": "string",
            "format": "date-time"
          },
          "occurredTo": {
            "description": "Only activities that happened at or before this time (ISO 8601).",
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "LeadActivityResponse": {
        "type": "object",
        "properties": {
          "activityType": {
            "description": "`CONTACT` (a call, message or meeting), `NOTE` or `FOLLOW_UP`.",
            "$ref": "#/components/schemas/LeadActivityType"
          },
          "actorId": {
            "type": "string",
            "format": "uuid",
            "description": "Member who logged it."
          },
          "channel": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LeadActivityChannel"
              },
              {
                "type": "null"
              }
            ],
            "description": "How contact was made: `PHONE`, `EMAIL`, `WHATSAPP`, `SMS`, `MEETING` or `OTHER`; `null` for notes."
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Contact used; `null` if not recorded."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "direction": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LeadActivityDirection"
              },
              {
                "type": "null"
              }
            ],
            "description": "`INBOUND` or `OUTBOUND`; `null` for notes and follow-ups."
          },
          "dueAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When a follow-up is due; `null` for other activities."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Activity ID."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text note."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (ISO 8601)."
          },
          "outcome": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LeadActivityOutcome"
              },
              {
                "type": "null"
              }
            ],
            "description": "Result of a contact attempt, for example `CONNECTED` or `NO_ANSWER`; `null` for notes and follow-ups."
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was logged (ISO 8601)."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on each correction. Send it as `expectedRevision`."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "voidReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why it was voided; `null` unless voided."
          },
          "voidedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was voided; `null` unless voided."
          },
          "voidedBy": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Member who voided it; `null` unless voided."
          }
        },
        "required": [
          "activityType",
          "actorId",
          "channel",
          "contactId",
          "createdAt",
          "direction",
          "dueAt",
          "id",
          "leadId",
          "note",
          "occurredAt",
          "outcome",
          "recordedAt",
          "revision",
          "updatedAt",
          "voidReason",
          "voidedAt",
          "voidedBy"
        ],
        "additionalProperties": false
      },
      "LeadActivityType": {
        "type": "string",
        "enum": [
          "CONTACT",
          "NOTE",
          "FOLLOW_UP"
        ]
      },
      "LeadAllocationRulesV1": {
        "maxItems": 200,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/LeadAllocationRuleV1"
        }
      },
      "LeadAllocationRuleV1": {
        "type": "object",
        "properties": {
          "all": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AllocationCondition"
            },
            "description": "Conditions that must all match for the rule to apply."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead allocation rule."
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Evaluation order: lower numbers are checked first, and the first match wins."
          },
          "strategy": {
            "$ref": "#/components/schemas/AllocationStrategy",
            "description": "How an owner is picked, from the values below."
          },
          "teamId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the team."
          },
          "userId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the user; `null` if none."
          }
        },
        "required": [
          "all",
          "id",
          "priority",
          "strategy",
          "teamId",
          "userId"
        ],
        "additionalProperties": false
      },
      "LeadAssignedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "lead.assigned",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "previousOwner": {
                "description": "Owner and team before the change; both `null` for a lead that had no owner.",
                "$ref": "#/components/schemas/PublicOwner"
              },
              "owner": {
                "description": "New owner and team.",
                "$ref": "#/components/schemas/PublicOwner"
              },
              "method": {
                "type": "string",
                "enum": [
                  "rule",
                  "manual",
                  "system"
                ],
                "description": "How it was assigned: `rule` (an allocation rule), `manual` (a person chose the owner) or `system` (LMS reassigned it, for example when a member was deactivated)."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "previousOwner",
              "owner",
              "method",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "LeadAssignmentEventResponse": {
        "type": "object",
        "properties": {
          "actorId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Who made the change: a user ID, or the name of the LMS service."
          },
          "actorType": {
            "type": "string",
            "enum": [
              "USER",
              "SERVICE"
            ],
            "description": "`USER` for a person (or an API key acting as one), `SERVICE` for LMS automation."
          },
          "allocationVersionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Version of the allocation rules applied; `null` for manual changes."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of this assignment change."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "matchedRuleId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Allocation rule that matched; `null` for manual changes."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {},
            "description": "Extra details recorded with the change."
          },
          "newTeamId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Team after the change."
          },
          "newUserId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Owner after the change; `null` when it went to a team queue."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601)."
          },
          "previousTeamId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Team before the change."
          },
          "previousUserId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Owner before the change."
          },
          "reasonCode": {
            "type": "string",
            "description": "Machine-readable reason for the change, for example `MANUAL_REASSIGNMENT`."
          },
          "source": {
            "type": "string",
            "enum": [
              "RULE",
              "MANUAL",
              "SYSTEM"
            ],
            "description": "`RULE` (allocation rules), `MANUAL` (a person) or `SYSTEM`."
          },
          "strategy": {
            "type": "string",
            "enum": [
              "FIXED_AGENT",
              "TEAM_QUEUE",
              "ROUND_ROBIN",
              "NONE"
            ],
            "description": "How the owner was picked: `FIXED_AGENT`, `TEAM_QUEUE` (left for the team to pick up), `ROUND_ROBIN` or `NONE`."
          }
        },
        "required": [
          "actorId",
          "actorType",
          "allocationVersionId",
          "id",
          "leadId",
          "matchedRuleId",
          "metadata",
          "newTeamId",
          "newUserId",
          "occurredAt",
          "previousTeamId",
          "previousUserId",
          "reasonCode",
          "source",
          "strategy"
        ],
        "additionalProperties": false
      },
      "LeadAssignmentState": {
        "type": "string",
        "enum": [
          "MY_LEADS",
          "MY_TEAM",
          "UNASSIGNED",
          "ALL"
        ]
      },
      "LeadCampaignEventResponse": {
        "type": "object",
        "properties": {
          "actorId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Who made the change: a user ID, or the name of the LMS service."
          },
          "actorType": {
            "type": "string",
            "enum": [
              "USER",
              "SERVICE"
            ],
            "description": "`USER` for a person (or an API key acting as one), `SERVICE` for LMS automation."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of this campaign change."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {},
            "description": "Extra details recorded with the change."
          },
          "newCampaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign after the change."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601)."
          },
          "previousCampaignId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Campaign before the change; `null` for the first campaign."
          },
          "reasonCode": {
            "type": "string",
            "description": "Machine-readable reason for the change, for example `MANUAL_REASSIGNMENT`."
          },
          "source": {
            "type": "string",
            "enum": [
              "INITIAL",
              "MANUAL",
              "SYSTEM"
            ],
            "description": "`INITIAL` (when the lead was created), `MANUAL` (a person moved it) or `SYSTEM`."
          }
        },
        "required": [
          "actorId",
          "actorType",
          "id",
          "leadId",
          "metadata",
          "newCampaignId",
          "occurredAt",
          "previousCampaignId",
          "reasonCode",
          "source"
        ],
        "additionalProperties": false
      },
      "LeadContactCreateRequest": {
        "type": "object",
        "properties": {
          "contactType": {
            "description": "Kind of contact. `PHONE` and `WHATSAPP` take a phone number (7–15 digits, `+` country code recommended), `EMAIL` an email address, `OTHER` any text.",
            "$ref": "#/components/schemas/LeadContactType"
          },
          "isPrimary": {
            "default": false,
            "description": "Make this the lead's main contact of its kind (agents call or write to it first).",
            "type": "boolean"
          },
          "label": {
            "description": "Your label for it, for example `Work` or `Home`.",
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The phone number, email address or other value, as the person gave it. LMS stores a normalised copy for matching duplicates."
          },
          "expectedUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The lead's `updatedAt` from your last read; `409` if it changed since."
          }
        },
        "required": [
          "contactType",
          "value",
          "expectedUpdatedAt"
        ],
        "additionalProperties": false
      },
      "LeadContactDeactivateRequest": {
        "type": "object",
        "properties": {
          "expectedUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The lead's `updatedAt` from your last read; `409` if it changed since."
          }
        },
        "required": [
          "expectedUpdatedAt"
        ],
        "additionalProperties": false
      },
      "LeadContactInput": {
        "type": "object",
        "properties": {
          "contactType": {
            "description": "Kind of contact. `PHONE` and `WHATSAPP` take a phone number (7–15 digits, `+` country code recommended), `EMAIL` an email address, `OTHER` any text.",
            "$ref": "#/components/schemas/LeadContactType"
          },
          "isPrimary": {
            "default": false,
            "description": "Make this the lead's main contact of its kind (agents call or write to it first).",
            "type": "boolean"
          },
          "label": {
            "description": "Your label for it, for example `Work` or `Home`.",
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The phone number, email address or other value, as the person gave it. LMS stores a normalised copy for matching duplicates."
          }
        },
        "required": [
          "contactType",
          "value"
        ],
        "additionalProperties": false
      },
      "LeadContactMetadataRequest": {
        "type": "object",
        "properties": {
          "expectedUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The lead's `updatedAt` from your last read; `409` if it changed since."
          },
          "isPrimary": {
            "description": "Make this the main contact of its kind.",
            "type": "boolean"
          },
          "label": {
            "description": "New label; `null` clears it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "expectedUpdatedAt"
        ],
        "additionalProperties": false
      },
      "LeadContactReplaceRequest": {
        "type": "object",
        "properties": {
          "expectedUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The lead's `updatedAt` from your last read; `409` if it changed since."
          },
          "isPrimary": {
            "description": "Make the new value the main contact of its kind.",
            "type": "boolean"
          },
          "label": {
            "description": "Label for the new value; `null` clears it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The new phone number, email or other value. The old one is kept as removed."
          }
        },
        "required": [
          "expectedUpdatedAt",
          "value"
        ],
        "additionalProperties": false
      },
      "LeadContactResponse": {
        "type": "object",
        "properties": {
          "contactType": {
            "description": "Kind of contact: `PHONE`, `EMAIL`, `WHATSAPP` or `OTHER`.",
            "$ref": "#/components/schemas/LeadContactType"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "displayValue": {
            "type": "string",
            "description": "The value as entered, for display."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Contact ID."
          },
          "isPrimary": {
            "type": "boolean",
            "description": "Whether it is the lead's main contact of its kind."
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Your label, for example `Work`."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "normalizedValue": {
            "type": "string",
            "description": "Normalised form used for duplicate matching (E.164 for phones, lower case for emails)."
          },
          "replacedById": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Contact that replaced this one; `null` unless replaced."
          },
          "status": {
            "description": "`ACTIVE`, or `REMOVED` after it was removed or replaced.",
            "$ref": "#/components/schemas/LeadContactStatus"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "contactType",
          "createdAt",
          "displayValue",
          "id",
          "isPrimary",
          "label",
          "leadId",
          "normalizedValue",
          "replacedById",
          "status",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "LeadContactStatus": {
        "type": "string",
        "enum": [
          "ACTIVE",
          "REMOVED"
        ]
      },
      "LeadContactType": {
        "type": "string",
        "enum": [
          "PHONE",
          "EMAIL",
          "WHATSAPP",
          "OTHER"
        ]
      },
      "LeadCreatedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "lead.created",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "LeadDetailResponse": {
        "type": "object",
        "properties": {
          "acquisition": {
            "description": "Where the lead came from: source, ad and UTM details of the first enquiry.",
            "$ref": "#/components/schemas/LeadAcquisitionResponse"
          },
          "assignmentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadAssignmentEventResponse"
            },
            "description": "Every owner change, oldest first."
          },
          "campaignHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadCampaignEventResponse"
            },
            "description": "Every campaign move, oldest first."
          },
          "identitySignals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadIdentityResponse"
            },
            "description": "Phone numbers, emails and other identifiers used to match duplicates."
          },
          "lead": {
            "description": "The lead itself.",
            "$ref": "#/components/schemas/LeadSummaryResponse"
          },
          "lifecycle": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadLifecycleResponse"
            },
            "description": "Every stage change, oldest first."
          },
          "merges": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the merge."
                },
                "mergedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When it was merged (ISO 8601)."
                },
                "mergedLeadId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the merged lead."
                },
                "moved": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "description": "Records moved from the merged lead, counted by kind."
                }
              },
              "required": [
                "id",
                "mergedAt",
                "mergedLeadId",
                "moved"
              ],
              "additionalProperties": false
            },
            "description": "Leads merged into this one, newest first."
          },
          "mergedIntoLeadId": {
            "description": "Set when this lead was merged into another; open that lead instead.",
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "segmentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadSegmentEventResponse"
            },
            "description": "Every segment change, oldest first."
          }
        },
        "required": [
          "acquisition",
          "assignmentHistory",
          "campaignHistory",
          "identitySignals",
          "lead",
          "lifecycle",
          "segmentHistory"
        ],
        "additionalProperties": false
      },
      "LeadExceptionResponse": {
        "type": "object",
        "properties": {
          "attemptCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of attempt records."
          },
          "batchId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the batch."
          },
          "category": {
            "type": "string",
            "description": "Category, from the values below."
          },
          "kind": {
            "type": "string",
            "enum": [
              "SOURCE_RECORD",
              "PERMANENT_REJECTION",
              "DELIVERY_RECONCILIATION"
            ],
            "description": "Kind of lead exception."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (ISO 8601)."
          },
          "providerRecordId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the provider record; `null` if none."
          },
          "reasonCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Machine-readable reason. Branch on this, not on the summary."
          },
          "receiptReceivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was receipt received (ISO 8601)."
          },
          "retryable": {
            "type": "boolean",
            "description": "Whether replaying the record may succeed without changing it."
          },
          "safeSummary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Plain-language summary with personal data removed."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source connection."
          },
          "sourceConnectionName": {
            "type": "string",
            "description": "Name of the source connection, as shown in the LMS."
          },
          "sourceRecordId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the source record; `null` if none."
          }
        },
        "required": [
          "attemptCount",
          "category",
          "kind",
          "occurredAt",
          "providerRecordId",
          "reasonCode",
          "receiptReceivedAt",
          "retryable",
          "safeSummary",
          "sourceConnectionId",
          "sourceConnectionName",
          "sourceRecordId"
        ],
        "additionalProperties": false
      },
      "LeadIdentityResponse": {
        "type": "object",
        "properties": {
          "displayValue": {
            "type": "string",
            "description": "The value as entered."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Identifier ID."
          },
          "isPrimary": {
            "type": "boolean",
            "description": "Whether it is the main identifier of its kind."
          },
          "normalizedValue": {
            "type": "string",
            "description": "Normalised form used for duplicate matching."
          },
          "signalType": {
            "type": "string",
            "enum": [
              "PHONE",
              "EMAIL",
              "WHATSAPP",
              "PROVIDER_PROFILE",
              "OTHER"
            ],
            "description": "`PHONE`, `EMAIL`, `WHATSAPP`, `PROVIDER_PROFILE` (for example a Meta profile ID) or `OTHER`."
          },
          "status": {
            "description": "`ACTIVE` or `REMOVED`.",
            "$ref": "#/components/schemas/LeadContactStatus"
          }
        },
        "required": [
          "displayValue",
          "id",
          "isPrimary",
          "normalizedValue",
          "signalType",
          "status"
        ],
        "additionalProperties": false
      },
      "LeadImportCommitRequest": {
        "type": "object",
        "properties": {
          "file": {
            "description": "The spreadsheet (`.xlsx` or `.csv`).",
            "$ref": "#/components/schemas/LeadImportFile"
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "sheetName": {
            "type": "string",
            "maxLength": 200,
            "description": "Name of the worksheet."
          },
          "mapping": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "maxLength": 80
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": 0,
              "maximum": 49
            },
            "description": "Lead field → column index."
          },
          "reviewToken": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Token from the preview; it ties the import to exactly what you reviewed."
          }
        },
        "required": [
          "file",
          "campaignId",
          "reviewToken"
        ],
        "additionalProperties": false
      },
      "LeadImportFile": {
        "type": "object",
        "properties": {
          "fileName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "File name, as uploaded."
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2796204,
            "pattern": "^[A-Za-z0-9+/]*={0,2}$",
            "description": "The file, Base64-encoded."
          }
        },
        "required": [
          "fileName",
          "content"
        ],
        "additionalProperties": false
      },
      "LeadImportPreviewRequest": {
        "type": "object",
        "properties": {
          "file": {
            "description": "The spreadsheet (`.xlsx` or `.csv`).",
            "$ref": "#/components/schemas/LeadImportFile"
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "sheetName": {
            "type": "string",
            "maxLength": 200,
            "description": "Name of the worksheet."
          },
          "mapping": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "maxLength": 80
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": 0,
              "maximum": 49
            },
            "description": "Lead field → column index."
          }
        },
        "required": [
          "file",
          "campaignId"
        ],
        "additionalProperties": false
      },
      "LeadImportPreviewResponse": {
        "type": "object",
        "properties": {
          "fileName": {
            "type": "string",
            "description": "Uploaded file name."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign the leads go into."
          },
          "campaignName": {
            "type": "string",
            "description": "Campaign name."
          },
          "sheetName": {
            "type": "string",
            "description": "Sheet read from the workbook."
          },
          "sheetNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "All sheets in the workbook."
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Column headings found in the sheet."
          },
          "mapping": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            },
            "description": "Lead field → column index used for the import."
          },
          "targets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "description": "Field key."
                },
                "label": {
                  "type": "string",
                  "description": "Field name."
                },
                "required": {
                  "type": "boolean",
                  "description": "Whether the field must be mapped."
                },
                "hint": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Help for mapping the field."
                }
              },
              "required": [
                "key",
                "label",
                "required",
                "hint"
              ],
              "additionalProperties": false
            },
            "description": "Lead fields a column can be mapped to."
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "rowNumber": {
                  "type": "number",
                  "description": "Row number in the sheet."
                },
                "fullName": {
                  "type": "string",
                  "description": "Name from the row."
                },
                "companyName": {
                  "type": "string",
                  "description": "Company from the row."
                },
                "phone": {
                  "type": "string",
                  "description": "Phone number from the row."
                },
                "productInterest": {
                  "type": "string",
                  "description": "Product interest from the row."
                },
                "errors": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Why the row would be refused; empty when valid."
                },
                "duplicate": {
                  "type": "boolean",
                  "description": "Whether the row matches an existing lead."
                }
              },
              "required": [
                "rowNumber",
                "fullName",
                "companyName",
                "phone",
                "productInterest",
                "errors",
                "duplicate"
              ],
              "additionalProperties": false
            },
            "description": "First rows as they would be imported."
          },
          "rowCount": {
            "type": "number",
            "description": "Rows in the sheet."
          },
          "validCount": {
            "type": "number",
            "description": "Rows that would be imported."
          },
          "invalidCount": {
            "type": "number",
            "description": "Rows that would be refused."
          },
          "duplicateCount": {
            "type": "number",
            "description": "Rows that match existing leads."
          },
          "reviewToken": {
            "type": "string",
            "description": "Send it with Import a spreadsheet to import exactly this preview."
          }
        },
        "required": [
          "fileName",
          "campaignId",
          "campaignName",
          "sheetName",
          "sheetNames",
          "columns",
          "mapping",
          "targets",
          "rows",
          "rowCount",
          "validCount",
          "invalidCount",
          "duplicateCount",
          "reviewToken"
        ],
        "additionalProperties": false
      },
      "LeadImportResult": {
        "type": "object",
        "properties": {
          "batchId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the batch."
          },
          "fileName": {
            "type": "string",
            "description": "File name, as uploaded."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "createdCount": {
            "type": "number",
            "description": "Number of created records."
          },
          "duplicateCount": {
            "type": "number",
            "description": "Number of duplicate records."
          },
          "alreadyImported": {
            "type": "boolean",
            "description": "`true` when this exact preview was imported before; nothing was imported twice."
          },
          "leads": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "leadId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the lead."
                },
                "rowNumber": {
                  "type": "number",
                  "description": "Row number in the sheet."
                },
                "fullName": {
                  "type": "string",
                  "description": "Full name."
                },
                "companyName": {
                  "type": "string",
                  "description": "Company name."
                }
              },
              "required": [
                "leadId",
                "rowNumber",
                "fullName",
                "companyName"
              ],
              "additionalProperties": false
            },
            "description": "Leads created, by sheet row."
          },
          "repeatEnquiryCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of repeat enquiry records."
          }
        },
        "required": [
          "batchId",
          "fileName",
          "campaignId",
          "createdCount",
          "duplicateCount",
          "alreadyImported",
          "leads"
        ],
        "additionalProperties": false
      },
      "LeadLifecycleResponse": {
        "type": "object",
        "properties": {
          "actorId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Who made the change: a user ID, or the name of the LMS service."
          },
          "actorType": {
            "type": "string",
            "enum": [
              "USER",
              "SERVICE"
            ],
            "description": "`USER` for a person (or an API key acting as one), `SERVICE` for LMS automation."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of this stage change."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {},
            "description": "Extra details recorded with the change."
          },
          "newStageCategory": {
            "description": "Meaning of the new stage.",
            "$ref": "#/components/schemas/SemanticStageCategory"
          },
          "newStageId": {
            "type": "string",
            "format": "uuid",
            "description": "Stage the lead moved to."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601)."
          },
          "previousStageCategory": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SemanticStageCategory"
              },
              {
                "type": "null"
              }
            ],
            "description": "Meaning of the previous stage; `null` for the first stage."
          },
          "previousStageId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Stage the lead left; `null` for the first stage."
          },
          "reasonCode": {
            "type": "string",
            "description": "Machine-readable reason for the change, for example `MANUAL_REASSIGNMENT`."
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When LMS recorded it (ISO 8601)."
          }
        },
        "required": [
          "actorId",
          "actorType",
          "id",
          "metadata",
          "newStageCategory",
          "newStageId",
          "occurredAt",
          "previousStageCategory",
          "previousStageId",
          "reasonCode",
          "recordedAt"
        ],
        "additionalProperties": false
      },
      "LeadListQuery": {
        "type": "object",
        "properties": {
          "cursor": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Opaque cursor from the previous page's `nextCursor`. Leave it out to start at the first page."
          },
          "limit": {
            "default": 50,
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Maximum number of records to return in one page."
          },
          "search": {
            "description": "Text to look for in the lead's name, company, phone numbers and email addresses. Partial and case-insensitive: `asha` matches `Asha Verma`, `98123` matches `+919812345678`.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "firstTouchSource": {
            "description": "Only leads whose first enquiry came from this kind of source, by source type key (for example `meta_lead_ads` or `website_form`; see List source types).",
            "$ref": "#/components/schemas/LeadTouchSourceKey"
          },
          "lastTouchSource": {
            "description": "Only leads whose latest enquiry came from this kind of source, by source type key.",
            "$ref": "#/components/schemas/LeadTouchSourceKey"
          },
          "assignedTeamId": {
            "description": "Only leads owned by this team.",
            "type": "string",
            "format": "uuid"
          },
          "assignedUserId": {
            "description": "Only leads owned by this member (user ID).",
            "type": "string",
            "format": "uuid"
          },
          "assignmentState": {
            "default": "ALL",
            "description": "Whose leads: `MY_LEADS` (owned by the API key's acting member), `MY_TEAM` (owned by that member's teams), `UNASSIGNED` (no team yet) or `ALL`.",
            "$ref": "#/components/schemas/LeadAssignmentState"
          },
          "campaignId": {
            "description": "Only leads in this campaign.",
            "type": "string",
            "format": "uuid"
          },
          "segmentId": {
            "description": "Only leads in this segment.",
            "type": "string",
            "format": "uuid"
          },
          "currentStageId": {
            "description": "Only leads currently in this pipeline stage.",
            "type": "string",
            "format": "uuid"
          },
          "processId": {
            "description": "Only leads in this sales process.",
            "type": "string",
            "format": "uuid"
          },
          "providerSubmittedFrom": {
            "description": "Only leads the sending system (for example Meta) says were submitted at or after this time (ISO 8601).",
            "type": "string",
            "format": "date-time"
          },
          "providerSubmittedTo": {
            "description": "Only leads submitted, per the sending system, at or before this time (ISO 8601).",
            "type": "string",
            "format": "date-time"
          },
          "receivedFrom": {
            "description": "Only leads LMS received at or after this time (ISO 8601).",
            "type": "string",
            "format": "date-time"
          },
          "receivedTo": {
            "description": "Only leads LMS received at or before this time (ISO 8601).",
            "type": "string",
            "format": "date-time"
          },
          "sourceConnectionId": {
            "description": "Only leads that arrived through this source.",
            "type": "string",
            "format": "uuid"
          },
          "stageCategory": {
            "description": "Only leads whose stage has this meaning, whatever the stage is called in each process.",
            "$ref": "#/components/schemas/SemanticStageCategory"
          },
          "stageScope": {
            "description": "`open` keeps only leads still being worked (`NEW`, `OPEN`, `CONTACTED` or `QUALIFIED` stages).",
            "type": "string",
            "const": "open"
          },
          "sla": {
            "description": "Only leads with a running SLA clock in this state: `AT_RISK` (due soon) or `BREACHED` (overdue).",
            "$ref": "#/components/schemas/LeadSlaFilter"
          },
          "sort": {
            "default": "received-desc",
            "description": "`received-desc` (newest first) or `received-asc` (oldest first), by the time LMS received the lead.",
            "$ref": "#/components/schemas/LeadListSort"
          }
        },
        "additionalProperties": false
      },
      "LeadListSort": {
        "type": "string",
        "enum": [
          "received-desc",
          "received-asc"
        ]
      },
      "LeadMergedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "lead.merged",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "mergedLeadIds": {
                "minItems": 1,
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "description": "IDs of the duplicate leads folded into `lead`. They no longer exist; map them to `lead.id`."
              },
              "mergedAt": {
                "type": "string",
                "format": "date-time",
                "description": "When the merge happened (ISO 8601)."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "mergedLeadIds",
              "mergedAt",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "LeadOwnershipResponse": {
        "type": "object",
        "properties": {
          "assignmentLocked": {
            "type": "boolean",
            "description": "`true` when the owner was set by hand, so allocation rules leave it alone."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign of the lead."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "segmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Segment of the lead; `null` if none."
          },
          "segmentLocked": {
            "type": "boolean",
            "description": "`true` when the segment was set by hand, so segmentation rules leave it alone."
          },
          "teamId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Owning team; `null` if unassigned."
          },
          "userId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Owning member; `null` while in a team queue."
          }
        },
        "required": [
          "assignmentLocked",
          "campaignId",
          "leadId",
          "segmentId",
          "segmentLocked",
          "teamId",
          "userId"
        ],
        "additionalProperties": false
      },
      "LeadPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadSummaryResponse"
            },
            "description": "Leads on this page, in `sort` order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          },
          "totalCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of leads matching the filters, across all pages."
          }
        },
        "required": [
          "items",
          "nextCursor",
          "totalCount"
        ],
        "additionalProperties": false
      },
      "LeadPriority": {
        "type": "string",
        "enum": [
          "LOW",
          "MEDIUM",
          "HIGH",
          "URGENT"
        ]
      },
      "LeadProfileResponse": {
        "type": "object",
        "properties": {
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "priority": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 4
              },
              {
                "type": "null"
              }
            ],
            "description": "Priority rank after the change: `1` low … `4` urgent; `null` when not set."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The lead's new `updatedAt`. Use it as `expectedUpdatedAt` next time."
          }
        },
        "required": [
          "leadId",
          "priority",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "LeadReevaluationResponse": {
        "type": "object",
        "properties": {
          "assignmentLocked": {
            "type": "boolean",
            "description": "`true` when the owner was set by hand, so allocation rules leave it alone."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign of the lead."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "segmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Segment of the lead; `null` if none."
          },
          "segmentLocked": {
            "type": "boolean",
            "description": "`true` when the segment was set by hand, so segmentation rules leave it alone."
          },
          "teamId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Owning team; `null` if unassigned."
          },
          "userId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Owning member; `null` while in a team queue."
          },
          "assignmentChanged": {
            "type": "boolean",
            "description": "Whether re-running the rules changed the owner."
          },
          "segmentChanged": {
            "type": "boolean",
            "description": "Whether re-running the rules changed the segment."
          }
        },
        "required": [
          "assignmentLocked",
          "campaignId",
          "leadId",
          "segmentId",
          "segmentLocked",
          "teamId",
          "userId",
          "assignmentChanged",
          "segmentChanged"
        ],
        "additionalProperties": false
      },
      "LeadRepeatEnquiryEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "lead.repeat_enquiry",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "enquiry": {
                "type": "object",
                "properties": {
                  "source": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/PublicLeadSource"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Source the new enquiry came through; `null` if entered by hand."
                  },
                  "externalRecordId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The record's ID in the sending system (for example a Meta lead ID), if any."
                  },
                  "receivedAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the new enquiry arrived (ISO 8601)."
                  }
                },
                "required": [
                  "source",
                  "externalRecordId",
                  "receivedAt"
                ],
                "additionalProperties": false,
                "description": "The new enquiry that matched this existing lead."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "enquiry",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "LeadSegmentationRulesV1": {
        "maxItems": 200,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/LeadSegmentationRuleV1"
        }
      },
      "LeadSegmentationRulesV2": {
        "maxItems": 200,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/LeadSegmentationRuleV2"
        }
      },
      "LeadSegmentationRuleV1": {
        "type": "object",
        "properties": {
          "all": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SegmentationCondition"
            },
            "description": "Conditions that must all match for the rule to apply."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead segmentation rule."
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Evaluation order: lower numbers are checked first, and the first match wins."
          },
          "segmentId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the segment."
          }
        },
        "required": [
          "all",
          "id",
          "priority",
          "segmentId"
        ],
        "additionalProperties": false
      },
      "LeadSegmentationRuleV2": {
        "type": "object",
        "properties": {
          "all": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SegmentationCondition"
            },
            "description": "Conditions that must all match for the rule to apply."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead segmentation rule."
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Evaluation order: lower numbers are checked first, and the first match wins."
          },
          "segmentId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the segment."
          }
        },
        "required": [
          "all",
          "id",
          "priority",
          "segmentId"
        ],
        "additionalProperties": false
      },
      "LeadSegmentEventResponse": {
        "type": "object",
        "properties": {
          "actorId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Who made the change: a user ID, or the name of the LMS service."
          },
          "actorType": {
            "type": "string",
            "enum": [
              "USER",
              "SERVICE"
            ],
            "description": "`USER` for a person (or an API key acting as one), `SERVICE` for LMS automation."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of this segment change."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "matchedRuleId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Segmentation rule that matched; `null` for manual changes."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {},
            "description": "Extra details recorded with the change."
          },
          "newSegmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Segment after the change; `null` when removed from segments."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601)."
          },
          "previousSegmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Segment before the change."
          },
          "reasonCode": {
            "type": "string",
            "description": "Machine-readable reason for the change, for example `MANUAL_REASSIGNMENT`."
          },
          "segmentationVersionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Version of the segmentation rules applied."
          },
          "source": {
            "type": "string",
            "enum": [
              "RULE",
              "MANUAL",
              "SYSTEM"
            ],
            "description": "`RULE` (segmentation rules), `MANUAL` (a person) or `SYSTEM`."
          }
        },
        "required": [
          "actorId",
          "actorType",
          "id",
          "leadId",
          "matchedRuleId",
          "metadata",
          "newSegmentId",
          "occurredAt",
          "previousSegmentId",
          "reasonCode",
          "segmentationVersionId",
          "source"
        ],
        "additionalProperties": false
      },
      "LeadSegmentLookupQuery": {
        "type": "object",
        "properties": {
          "segmentIds": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of the segment records."
          }
        },
        "required": [
          "segmentIds"
        ],
        "additionalProperties": false
      },
      "LeadSegmentPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LeadSegmentResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "LeadSegmentResponse": {
        "type": "object",
        "properties": {
          "colorToken": {
            "$ref": "#/components/schemas/SegmentColorToken",
            "description": "Colour used to show it in the LMS."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text description."
          },
          "displayOrder": {
            "type": "integer",
            "minimum": 0,
            "description": "Position in lists; lower numbers come first."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the lead segment."
          },
          "name": {
            "type": "string",
            "description": "Name of the lead segment, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "status": {
            "$ref": "#/components/schemas/OwnershipConfigurationStatus",
            "description": "Current status of the lead segment."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "colorToken",
          "createdAt",
          "description",
          "displayOrder",
          "id",
          "name",
          "processId",
          "status",
          "tenantId",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "LeadSlaFilter": {
        "type": "string",
        "enum": [
          "AT_RISK",
          "BREACHED"
        ]
      },
      "LeadSlaSummary": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "ON_TRACK",
              "AT_RISK",
              "BREACHED"
            ],
            "description": "`ON_TRACK`, `AT_RISK` (due soon) or `BREACHED` (overdue)."
          },
          "dueAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the target is due (ISO 8601)."
          },
          "ruleName": {
            "type": "string",
            "description": "Name of the SLA rule, for example `First call in 5 minutes`."
          }
        },
        "required": [
          "state",
          "dueAt",
          "ruleName"
        ],
        "additionalProperties": false
      },
      "LeadSourceConnection": {
        "type": "object",
        "properties": {
          "configuration": {
            "type": "object",
            "additionalProperties": {},
            "description": "Settings specific to this kind of source."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "defaultCampaignId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the default campaign; `null` if none."
          },
          "externalAccountId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the external account; `null` if none."
          },
          "externalAccountName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of the external account, as shown in the LMS."
          },
          "id": {
            "$ref": "#/components/schemas/LeadSourceId",
            "description": "ID of the lead source connection."
          },
          "name": {
            "type": "string",
            "description": "Name of the lead source connection, as shown in the LMS."
          },
          "secretConfigured": {
            "type": "boolean",
            "description": "Whether a secret is stored for it."
          },
          "sourceDefinitionKey": {
            "type": "string",
            "description": "Source type key, for example `meta_lead_ads` (see List source types)."
          },
          "status": {
            "$ref": "#/components/schemas/LeadSourceStatus",
            "description": "Current status of the lead source connection."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "configuration",
          "createdAt",
          "defaultCampaignId",
          "externalAccountId",
          "externalAccountName",
          "id",
          "name",
          "secretConfigured",
          "sourceDefinitionKey",
          "status",
          "tenantId",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "LeadSourceDefinition": {
        "type": "object",
        "properties": {
          "availability": {
            "type": "string",
            "enum": [
              "GENERALLY_AVAILABLE",
              "APP_APPROVAL_REQUIRED",
              "PARTNER_AGREEMENT_REQUIRED",
              "CUSTOMER_CREDENTIALS_REQUIRED",
              "MANUAL_IMPORT_ONLY"
            ],
            "description": "Whether this source type can be connected in your workspace."
          },
          "channelCapabilities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Channels the source can deliver leads from."
          },
          "connectionMechanism": {
            "type": "string",
            "enum": [
              "WEBHOOK",
              "POLL_API",
              "OAUTH_API",
              "PARTNER_FEED",
              "FILE_IMPORT",
              "GENERIC_WEBHOOK",
              "MANUAL_ENTRY"
            ],
            "description": "How LMS receives leads: push from the sender, or polling."
          },
          "credentialMechanism": {
            "type": "string",
            "description": "How the source authenticates, for example an OAuth app or a signing secret."
          },
          "displayName": {
            "type": "string",
            "description": "Name shown in the LMS."
          },
          "key": {
            "type": "string",
            "description": "Stable machine key. Unlike the label, it never changes."
          },
          "maximumContractVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Newest payload version LMS accepts from it."
          },
          "minimumContractVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Oldest payload version LMS accepts from it."
          },
          "provider": {
            "type": "string",
            "description": "System behind the source, for example `meta` or `partner_api`."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DEPRECATED"
            ],
            "description": "Current status of the lead source definition."
          }
        },
        "required": [
          "availability",
          "channelCapabilities",
          "connectionMechanism",
          "credentialMechanism",
          "displayName",
          "key",
          "maximumContractVersion",
          "minimumContractVersion",
          "provider",
          "status"
        ],
        "additionalProperties": false
      },
      "LeadSourceId": {
        "type": "string",
        "format": "uuid"
      },
      "LeadSourceStatus": {
        "type": "string",
        "enum": [
          "DRAFT",
          "ACTIVE",
          "PAUSED",
          "ERROR",
          "DISCONNECTED",
          "ARCHIVED"
        ]
      },
      "LeadStageChangedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "lead.stage_changed",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "previousStage": {
                "description": "Stage the lead left.",
                "$ref": "#/components/schemas/PublicStage"
              },
              "stage": {
                "description": "Stage the lead moved to.",
                "$ref": "#/components/schemas/PublicStage"
              },
              "changedAt": {
                "type": "string",
                "format": "date-time",
                "description": "When the move happened (ISO 8601)."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "previousStage",
              "stage",
              "changedAt",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "LeadSummaryResponse": {
        "type": "object",
        "properties": {
          "appliedAllocationVersionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Version of the allocation rules that last assigned the lead; `null` if none ran."
          },
          "appliedSegmentationVersionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Version of the segmentation rules that last segmented the lead; `null` if none ran."
          },
          "assignedTeamId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Team that owns the lead; `null` while unassigned."
          },
          "assignedUserId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Member who owns the lead; `null` while it waits in the team's queue."
          },
          "assignmentLocked": {
            "type": "boolean",
            "description": "`true` when someone assigned the lead by hand, so allocation rules leave it alone."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "Campaign the lead belongs to."
          },
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "City."
          },
          "companyName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Company or business name."
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Country."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the lead record was created (ISO 8601)."
          },
          "currentSegmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Segment the lead is in; `null` if none."
          },
          "currentStageId": {
            "type": "string",
            "format": "uuid",
            "description": "Pipeline stage the lead is in."
          },
          "customAttributes": {
            "type": "object",
            "additionalProperties": {},
            "description": "Customer field values, keyed by field key."
          },
          "fullName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The person's full name."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "inquirySummary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the person asked for."
          },
          "lastConnectedAt": {
            "description": "Last time a call or message actually reached the person; `null` if never."
          },
          "lastContactAttemptAt": {
            "description": "Last time anyone tried to reach the person; `null` if never."
          },
          "platformReceivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When LMS received the lead (ISO 8601). Lists sort by this."
          },
          "priority": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 4
              },
              {
                "type": "null"
              }
            ],
            "description": "Priority rank: `1` low, `2` medium, `3` high, `4` urgent; `null` when not set. Requests set it by name (`LOW` … `URGENT`)."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "Sales process the lead belongs to."
          },
          "productInterest": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Product or service the person asked about."
          },
          "providerSubmittedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the person submitted the form, according to the sending system; `null` if not sent."
          },
          "segmentLocked": {
            "type": "boolean",
            "description": "`true` when someone set the segment by hand, so segmentation rules leave it alone."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "Source the lead first arrived through."
          },
          "sourceRecordId": {
            "type": "string",
            "format": "uuid",
            "description": "The raw source record the lead was created from."
          },
          "stageCategory": {
            "description": "What the current stage means: `NEW`, `OPEN`, `CONTACTED`, `QUALIFIED`, or the closed `CONVERTED`, `LOST` and `DISQUALIFIED`.",
            "$ref": "#/components/schemas/SemanticStageCategory"
          },
          "state": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "State or region."
          },
          "touches": {
            "description": "How many times the person enquired, and where the first and latest enquiries came from.",
            "$ref": "#/components/schemas/LeadTouchSummaryResponse"
          },
          "sla": {
            "description": "The most urgent running SLA target; `null` when none, absent where SLAs are off.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/LeadSlaSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the lead last changed (ISO 8601). Send it as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "appliedAllocationVersionId",
          "appliedSegmentationVersionId",
          "assignedTeamId",
          "assignedUserId",
          "assignmentLocked",
          "campaignId",
          "city",
          "companyName",
          "country",
          "createdAt",
          "currentSegmentId",
          "currentStageId",
          "customAttributes",
          "fullName",
          "id",
          "inquirySummary",
          "lastConnectedAt",
          "lastContactAttemptAt",
          "platformReceivedAt",
          "priority",
          "processId",
          "productInterest",
          "providerSubmittedAt",
          "segmentLocked",
          "sourceConnectionId",
          "sourceRecordId",
          "stageCategory",
          "state",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "LeadTouchResponse": {
        "type": "object",
        "properties": {
          "channel": {
            "type": "string",
            "description": "Kind of source, for example `META` or `WEBSITE`."
          },
          "externalCampaignName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Campaign name in the sending system (for example the Meta ad campaign), if sent."
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When this enquiry arrived (ISO 8601)."
          },
          "sourceDefinitionKey": {
            "type": "string",
            "description": "Source type key, for example `meta_lead_ads`; usable in `firstTouchSource`."
          }
        },
        "required": [
          "channel",
          "externalCampaignName",
          "receivedAt",
          "sourceDefinitionKey"
        ],
        "additionalProperties": false
      },
      "LeadTouchSourceKey": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9_]{0,63}$"
      },
      "LeadTouchSummaryResponse": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0,
            "description": "How many enquiries this lead has made."
          },
          "first": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LeadTouchResponse"
              },
              {
                "type": "null"
              }
            ],
            "description": "The first enquiry; `null` for leads created by hand."
          },
          "last": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LeadTouchResponse"
              },
              {
                "type": "null"
              }
            ],
            "description": "The latest enquiry; `null` for leads created by hand."
          }
        },
        "required": [
          "count",
          "first",
          "last"
        ],
        "additionalProperties": false
      },
      "LeadTransitionResponse": {
        "type": "object",
        "properties": {
          "isFirstConversion": {
            "type": "boolean",
            "description": "`true` the first time this lead reaches a `CONVERTED` stage."
          },
          "leadId": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the move happened (ISO 8601)."
          },
          "previousStageCategory": {
            "description": "Meaning of the stage the lead left.",
            "$ref": "#/components/schemas/SemanticStageCategory"
          },
          "previousStageId": {
            "type": "string",
            "format": "uuid",
            "description": "Stage the lead left."
          },
          "stageCategory": {
            "description": "Meaning of the new stage.",
            "$ref": "#/components/schemas/SemanticStageCategory"
          },
          "stageId": {
            "type": "string",
            "format": "uuid",
            "description": "Stage the lead is now in."
          }
        },
        "required": [
          "isFirstConversion",
          "leadId",
          "occurredAt",
          "previousStageCategory",
          "previousStageId",
          "stageCategory",
          "stageId"
        ],
        "additionalProperties": false
      },
      "LeadUpdatedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "lead.updated",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "changes": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "profile",
                    "contacts",
                    "campaign",
                    "priority"
                  ]
                },
                "description": "What changed: `profile` (name, company, location or product interest), `contacts`, `campaign` or `priority`. Read the new values from `lead`."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "changes",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "ManagedVoicebotCampaignConfigurationResponse": {
        "type": "object",
        "properties": {
          "callingProfileId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the calling profile."
          },
          "callerIdId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the caller ID."
          },
          "callingWindows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VoicebotCallingWindow"
            },
            "description": "When the voicebot may call: one entry per window."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "language": {
            "type": "string",
            "minLength": 2,
            "maxLength": 35,
            "description": "Language, as an IETF tag such as `en-IN` or `hi-IN`."
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "Most call attempts per lead."
          },
          "outcomeMappings": {
            "type": "object",
            "additionalProperties": false,
            "description": "Which lead stage or disposition each voicebot outcome maps to.",
            "properties": {
              "CONNECTED_INTERESTED": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `CONNECTED_INTERESTED`; `null` changes nothing."
              },
              "CONNECTED_NOT_INTERESTED": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `CONNECTED_NOT_INTERESTED`; `null` changes nothing."
              },
              "CALLBACK_REQUESTED": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `CALLBACK_REQUESTED`; `null` changes nothing."
              },
              "NO_ANSWER": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `NO_ANSWER`; `null` changes nothing."
              },
              "BUSY": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `BUSY`; `null` changes nothing."
              },
              "INVALID_NUMBER": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `INVALID_NUMBER`; `null` changes nothing."
              },
              "DO_NOT_CALL": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `DO_NOT_CALL`; `null` changes nothing."
              },
              "BOT_FAILED": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `BOT_FAILED`; `null` changes nothing."
              }
            }
          },
          "recordingConsentPolicyVersionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the recording consent policy version; `null` if none."
          },
          "recordingEnabled": {
            "type": "boolean",
            "description": "Record voicebot calls."
          },
          "retryBotFailureAfterAnswer": {
            "type": "boolean",
            "description": "Retry a call when the bot failed after the customer answered."
          },
          "publishedVersion": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Published configuration version; `null` before the first publish."
          },
          "retryDelaysMinutes": {
            "maxItems": 4,
            "type": "array",
            "items": {
              "type": "integer",
              "exclusiveMinimum": 0
            },
            "description": "Retry delays, in minutes."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "IANA time zone, for example `Asia/Kolkata`."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "voicebotProfileVersionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the voicebot profile version."
          }
        },
        "required": [
          "callingProfileId",
          "callerIdId",
          "callingWindows",
          "campaignId",
          "language",
          "maxAttempts",
          "outcomeMappings",
          "recordingConsentPolicyVersionId",
          "recordingEnabled",
          "retryBotFailureAfterAnswer",
          "publishedVersion",
          "retryDelaysMinutes",
          "revision",
          "timezone",
          "updatedAt",
          "voicebotProfileVersionId"
        ],
        "additionalProperties": false
      },
      "ManualRouteSourceRecordRequest": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 100,
            "pattern": "^[A-Z][A-Z0-9_:-]*$",
            "description": "Your reason code, in upper case (for example `CRM_SYNC`). Kept in the lead's history."
          },
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the revision."
          }
        },
        "required": [
          "campaignId",
          "reason"
        ],
        "additionalProperties": false
      },
      "MappingDraft": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the mapping draft."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "name": {
            "type": "string",
            "description": "Name of the mapping draft, as shown in the LMS."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source connection."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ],
            "description": "`ARCHIVED` drafts are kept for history."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceFieldMappingRule"
            },
            "description": "Rules, checked in `priority` order; the first match wins."
          }
        },
        "required": [
          "id",
          "tenantId",
          "name",
          "revision",
          "sourceConnectionId",
          "status",
          "createdAt",
          "updatedAt",
          "rules"
        ],
        "additionalProperties": false
      },
      "MappingVersion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the mapping version."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "mappingDefinitionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the mapping draft this was published from."
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Version number, from 1."
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceFieldMappingRule"
            },
            "description": "Rules, checked in `priority` order; the first match wins."
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was published (ISO 8601)."
          },
          "publishedBy": {
            "type": "string",
            "format": "uuid",
            "description": "User ID of the member who published it."
          }
        },
        "required": [
          "id",
          "tenantId",
          "mappingDefinitionId",
          "version",
          "rules",
          "publishedAt",
          "publishedBy"
        ],
        "additionalProperties": false
      },
      "MediaDownloadResponse": {
        "type": "object",
        "properties": {
          "downloadUrl": {
            "type": "string",
            "format": "uri",
            "description": "Signed URL to download the file; it works for `expiresIn` seconds."
          },
          "expiresIn": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Seconds until `downloadUrl` stops working."
          }
        },
        "required": [
          "downloadUrl",
          "expiresIn"
        ],
        "additionalProperties": false
      },
      "MessageDeliveredEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "message.delivered",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Message ID."
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "whatsapp",
                      "sms",
                      "email"
                    ],
                    "description": "Channel the message used."
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "outbound",
                      "inbound"
                    ],
                    "description": "`outbound` when LMS sent it, `inbound` when the lead wrote in."
                  },
                  "templateKey": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Key of the approved template used; `null` for free-form and inbound messages."
                  },
                  "sentAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When it was sent (or received, for inbound); `null` if not sent yet."
                  },
                  "deliveredAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When the provider confirmed delivery; `null` until then."
                  },
                  "failedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When delivery failed; `null` unless it failed."
                  },
                  "failureReason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Provider's reason for the failure, in plain language; `null` unless it failed."
                  }
                },
                "required": [
                  "id",
                  "channel",
                  "direction",
                  "templateKey",
                  "sentAt",
                  "deliveredAt",
                  "failedAt",
                  "failureReason"
                ],
                "additionalProperties": false,
                "description": "The message."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "message",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "MessageFailedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "message.failed",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Message ID."
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "whatsapp",
                      "sms",
                      "email"
                    ],
                    "description": "Channel the message used."
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "outbound",
                      "inbound"
                    ],
                    "description": "`outbound` when LMS sent it, `inbound` when the lead wrote in."
                  },
                  "templateKey": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Key of the approved template used; `null` for free-form and inbound messages."
                  },
                  "sentAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When it was sent (or received, for inbound); `null` if not sent yet."
                  },
                  "deliveredAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When the provider confirmed delivery; `null` until then."
                  },
                  "failedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When delivery failed; `null` unless it failed."
                  },
                  "failureReason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Provider's reason for the failure, in plain language; `null` unless it failed."
                  }
                },
                "required": [
                  "id",
                  "channel",
                  "direction",
                  "templateKey",
                  "sentAt",
                  "deliveredAt",
                  "failedAt",
                  "failureReason"
                ],
                "additionalProperties": false,
                "description": "The message."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "message",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "MessageReceivedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "message.received",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Message ID."
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "whatsapp",
                      "sms",
                      "email"
                    ],
                    "description": "Channel the message used."
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "outbound",
                      "inbound"
                    ],
                    "description": "`outbound` when LMS sent it, `inbound` when the lead wrote in."
                  },
                  "templateKey": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Key of the approved template used; `null` for free-form and inbound messages."
                  },
                  "sentAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When it was sent (or received, for inbound); `null` if not sent yet."
                  },
                  "deliveredAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When the provider confirmed delivery; `null` until then."
                  },
                  "failedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When delivery failed; `null` unless it failed."
                  },
                  "failureReason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Provider's reason for the failure, in plain language; `null` unless it failed."
                  }
                },
                "required": [
                  "id",
                  "channel",
                  "direction",
                  "templateKey",
                  "sentAt",
                  "deliveredAt",
                  "failedAt",
                  "failureReason"
                ],
                "additionalProperties": false,
                "description": "The message."
              },
              "text": {
                "description": "What the lead wrote. `null` when the endpoint or API key does not receive contact details.",
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 4096
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "message",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "MessageSentEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "message.sent",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Message ID."
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "whatsapp",
                      "sms",
                      "email"
                    ],
                    "description": "Channel the message used."
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "outbound",
                      "inbound"
                    ],
                    "description": "`outbound` when LMS sent it, `inbound` when the lead wrote in."
                  },
                  "templateKey": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Key of the approved template used; `null` for free-form and inbound messages."
                  },
                  "sentAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When it was sent (or received, for inbound); `null` if not sent yet."
                  },
                  "deliveredAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When the provider confirmed delivery; `null` until then."
                  },
                  "failedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When delivery failed; `null` unless it failed."
                  },
                  "failureReason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Provider's reason for the failure, in plain language; `null` unless it failed."
                  }
                },
                "required": [
                  "id",
                  "channel",
                  "direction",
                  "templateKey",
                  "sentAt",
                  "deliveredAt",
                  "failedAt",
                  "failureReason"
                ],
                "additionalProperties": false,
                "description": "The message."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "message",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "MoveLeadCampaignRequest": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 100,
            "pattern": "^[A-Z][A-Z0-9_:-]*$",
            "description": "Your reason code, in upper case (for example `CRM_SYNC`). Kept in the lead's history."
          }
        },
        "required": [
          "campaignId",
          "reason"
        ],
        "additionalProperties": false
      },
      "OwnershipConditionValue": {
        "anyOf": [
          {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          },
          {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          }
        ]
      },
      "OwnershipConfigurationStatus": {
        "type": "string",
        "enum": [
          "ACTIVE",
          "ARCHIVED"
        ]
      },
      "OwnershipOperator": {
        "type": "string",
        "enum": [
          "EQUALS",
          "IN",
          "EXISTS",
          "CONTAINS",
          "GREATER_THAN_OR_EQUAL",
          "LESS_THAN_OR_EQUAL"
        ]
      },
      "PartnerIntakeReceipt": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Receipt ID. Look the receipt up again with it."
          },
          "leadId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "The created or matched lead, if any."
          },
          "sourceRecordId": {
            "type": "string",
            "format": "uuid",
            "description": "The stored source record."
          },
          "status": {
            "$ref": "#/components/schemas/PartnerIntakeStatus",
            "description": "Current status of the partner intake receipt."
          },
          "reasonCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Machine-readable detail, for example `LEAD_CREATED`, `REPEAT_ENQUIRY` or `MAPPING_VERSION_NOT_FOUND`."
          }
        },
        "required": [
          "id",
          "leadId",
          "sourceRecordId",
          "status",
          "reasonCode"
        ],
        "additionalProperties": false,
        "description": "The saved outcome of one lead submission."
      },
      "PartnerIntakeRequest": {
        "type": "object",
        "properties": {
          "externalRecordId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Your system's ID for this record. Repeat submissions are matched on it."
          },
          "fields": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            },
            "description": "Source fields, keyed by the field names you configured in the source's mapping. Values may be any JSON."
          }
        },
        "required": [
          "externalRecordId",
          "fields"
        ],
        "additionalProperties": false,
        "description": "One lead submitted to a Partner API source."
      },
      "PartnerIntakeStatus": {
        "type": "string",
        "enum": [
          "MATERIALIZED",
          "DUPLICATE",
          "NEEDS_MAPPING",
          "NEEDS_ROUTING"
        ],
        "description": "`MATERIALIZED`: a lead was created. `DUPLICATE`: the record matched an existing lead. `NEEDS_MAPPING` / `NEEDS_ROUTING`: the record is held until the source's mapping or routing is fixed; it is replayed from the LMS intake workspace."
      },
      "PartnerRecordingList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128,
                  "description": "Recording ID."
                },
                "type": {
                  "type": "string",
                  "description": "`STEREO_MASTER` or `REDACTED_MASTER` (sensitive audio removed)."
                },
                "format": {
                  "type": "string",
                  "description": "Audio container, currently `wav`."
                }
              },
              "required": [
                "id",
                "type",
                "format"
              ],
              "additionalProperties": false
            },
            "description": "The records in this response, in the documented order."
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false,
        "description": "Recordings of one call that are ready to download."
      },
      "ProcessId": {
        "type": "string",
        "format": "uuid"
      },
      "ProcessPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProcessResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "ProcessResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "description": {
            "type": "string",
            "description": "Free-text description."
          },
          "id": {
            "$ref": "#/components/schemas/ProcessId",
            "description": "ID of the process."
          },
          "name": {
            "type": "string",
            "description": "Name of the process, as shown in the LMS."
          },
          "status": {
            "$ref": "#/components/schemas/ProcessStatus",
            "description": "Current status of the process."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "timezone": {
            "type": "string",
            "description": "IANA time zone, for example `Asia/Kolkata`."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "createdAt",
          "description",
          "id",
          "name",
          "status",
          "tenantId",
          "timezone",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ProcessStatus": {
        "type": "string",
        "enum": [
          "ACTIVE",
          "ARCHIVED"
        ]
      },
      "ProcessVoicebotPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProcessVoicebotSummary"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "ProcessVoicebotSummary": {
        "type": "object",
        "properties": {
          "displayName": {
            "type": "string",
            "minLength": 2,
            "maxLength": 120,
            "description": "Name shown in the LMS."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process voicebot."
          },
          "language": {
            "type": "string",
            "minLength": 2,
            "maxLength": 35,
            "description": "Language, as an IETF tag such as `en-IN` or `hi-IN`."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "status": {
            "type": "string",
            "const": "ACTIVE",
            "description": "Current status of the process voicebot."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Version number."
          },
          "versionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the version."
          },
          "versionLabel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Label of the voicebot version, for example `v3`."
          }
        },
        "required": [
          "displayName",
          "id",
          "language",
          "processId",
          "status",
          "tenantId",
          "version",
          "versionId",
          "versionLabel"
        ],
        "additionalProperties": false
      },
      "PublicEvent": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/LeadCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/LeadUpdatedEvent"
          },
          {
            "$ref": "#/components/schemas/LeadStageChangedEvent"
          },
          {
            "$ref": "#/components/schemas/LeadAssignedEvent"
          },
          {
            "$ref": "#/components/schemas/LeadRepeatEnquiryEvent"
          },
          {
            "$ref": "#/components/schemas/LeadMergedEvent"
          },
          {
            "$ref": "#/components/schemas/FollowupCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/FollowupDueEvent"
          },
          {
            "$ref": "#/components/schemas/CallbackScheduledEvent"
          },
          {
            "$ref": "#/components/schemas/CallCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/CallDispositionedEvent"
          },
          {
            "$ref": "#/components/schemas/RecordingAvailableEvent"
          },
          {
            "$ref": "#/components/schemas/MessageSentEvent"
          },
          {
            "$ref": "#/components/schemas/MessageDeliveredEvent"
          },
          {
            "$ref": "#/components/schemas/MessageFailedEvent"
          },
          {
            "$ref": "#/components/schemas/MessageReceivedEvent"
          },
          {
            "$ref": "#/components/schemas/SequenceCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/SlaBreachedEvent"
          }
        ]
      },
      "PublicEventCatalogueResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "description": "Event type, for example `lead.created`.",
                  "$ref": "#/components/schemas/PublicEventType"
                },
                "version": {
                  "type": "number",
                  "const": 1,
                  "description": "Payload version."
                },
                "group": {
                  "type": "string",
                  "description": "Catalogue group, for example `Leads` or `Calls`."
                },
                "summary": {
                  "type": "string",
                  "description": "What the event means, in one sentence."
                },
                "example": {
                  "type": "object",
                  "additionalProperties": {},
                  "description": "A complete example event."
                }
              },
              "required": [
                "type",
                "version",
                "group",
                "summary",
                "example"
              ],
              "additionalProperties": false
            },
            "description": "Every event type the credential can receive."
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "PublicEventType": {
        "type": "string",
        "enum": [
          "lead.created",
          "lead.updated",
          "lead.stage_changed",
          "lead.assigned",
          "lead.repeat_enquiry",
          "lead.merged",
          "followup.created",
          "followup.due",
          "callback.scheduled",
          "call.completed",
          "call.dispositioned",
          "recording.available",
          "message.sent",
          "message.delivered",
          "message.failed",
          "message.received",
          "sequence.completed",
          "sla.breached"
        ]
      },
      "PublicLead": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Lead ID."
          },
          "contact": {
            "description": "Name, phone and email. Left out when the endpoint or API key is set not to receive contact details.",
            "$ref": "#/components/schemas/PublicLeadContact"
          },
          "company": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ],
            "description": "Company or business name."
          },
          "city": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "description": "City."
          },
          "state": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "description": "State or region."
          },
          "country": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "description": "Country."
          },
          "productInterest": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "What the person asked about, for example `Rooftop solar, 5 kW`."
          },
          "priority": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 4
              },
              {
                "type": "null"
              }
            ],
            "description": "Priority rank: `1` low, `2` medium, `3` high, `4` urgent; `null` when not set. Requests set it by name (`LOW` … `URGENT`)."
          },
          "stage": {
            "description": "Current pipeline stage.",
            "$ref": "#/components/schemas/PublicStage"
          },
          "process": {
            "description": "Sales process the lead belongs to.",
            "$ref": "#/components/schemas/PublicNamedRef"
          },
          "campaign": {
            "description": "Campaign the lead belongs to.",
            "$ref": "#/components/schemas/PublicNamedRef"
          },
          "owner": {
            "description": "Current owner and team.",
            "$ref": "#/components/schemas/PublicOwner"
          },
          "source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PublicLeadSource"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the lead first came from; `null` for leads created by hand."
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When LMS first received the enquiry (ISO 8601)."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the lead record was created (ISO 8601)."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the lead last changed (ISO 8601)."
          }
        },
        "required": [
          "id",
          "company",
          "city",
          "state",
          "country",
          "productInterest",
          "priority",
          "stage",
          "process",
          "campaign",
          "owner",
          "source",
          "receivedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "PublicLeadContact": {
        "type": "object",
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ],
            "description": "Full name of the person, as captured."
          },
          "phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "description": "Primary phone number, in E.164 format (`+919812345678`) where known."
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "description": "Primary email address."
          }
        },
        "required": [
          "name",
          "phone",
          "email"
        ],
        "additionalProperties": false
      },
      "PublicLeadSource": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Source connection ID."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Source name, for example `Website enquiry form`."
          },
          "channel": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ],
            "description": "Kind of source, for example `META`, `WEBSITE` or `PARTNER_API`; `null` if unknown."
          }
        },
        "required": [
          "id",
          "name",
          "channel"
        ],
        "additionalProperties": false
      },
      "PublicNamedRef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable ID of the record."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Display name, as shown in the LMS."
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      },
      "PublicOwner": {
        "type": "object",
        "properties": {
          "userId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID of the member who owns the lead; `null` while it waits in a team queue."
          },
          "team": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PublicNamedRef"
              },
              {
                "type": "null"
              }
            ],
            "description": "Team that owns the lead; `null` when it has no team."
          }
        },
        "required": [
          "userId",
          "team"
        ],
        "additionalProperties": false
      },
      "PublicStage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stage ID."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Stage name as configured in the process, for example `Qualified`."
          },
          "category": {
            "$ref": "#/components/schemas/PublicStageCategory",
            "description": "Category, from the values below."
          }
        },
        "required": [
          "id",
          "name",
          "category"
        ],
        "additionalProperties": false
      },
      "PublicStageCategory": {
        "type": "string",
        "enum": [
          "new",
          "open",
          "contacted",
          "qualified",
          "converted",
          "lost",
          "disqualified"
        ],
        "description": "What the stage means in every pipeline: `new` (not worked yet), `open` and `contacted` (in progress), `qualified`, then the closed outcomes `converted`, `lost` and `disqualified`."
      },
      "PublishMappingRequest": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "PublishRoutingRulesetRequest": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "PublishRulesetRequest": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "PublishVoicebotCampaignRequest": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "QmsAnalysis": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "description": "Version number."
          },
          "artifactId": {
            "type": "string",
            "description": "Recording the analysis ran on."
          },
          "checksum": {
            "type": "string",
            "description": "Checksum of the analysed recording."
          },
          "durationMs": {
            "type": "number",
            "description": "Recording length, ms."
          },
          "segments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QmsSegment"
            },
            "description": "Transcript, segment by segment."
          },
          "metrics": {
            "description": "Audio quality metrics.",
            "$ref": "#/components/schemas/QmsMetrics"
          },
          "scores": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QmsScore"
            },
            "description": "Score for each parameter."
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "description": "Kind of finding."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable message. Do not branch on it; the wording may change."
                },
                "segmentIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Transcript segments the finding refers to."
                },
                "status": {
                  "type": "string",
                  "const": "SUGGESTED",
                  "description": "Current status of the finding."
                }
              },
              "required": [
                "kind",
                "message",
                "segmentIds",
                "status"
              ],
              "additionalProperties": false
            },
            "description": "Things the scorer suggests a reviewer checks."
          },
          "expressions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "AGENT",
                    "CUSTOMER"
                  ],
                  "description": "Who spoke: the agent or the customer."
                },
                "startMs": {
                  "type": "number",
                  "description": "Start, in milliseconds."
                },
                "endMs": {
                  "type": "number",
                  "description": "End, in milliseconds."
                },
                "label": {
                  "type": "string",
                  "description": "Display label."
                },
                "confidence": {
                  "type": "number",
                  "description": "Model confidence, 0–1."
                },
                "model": {
                  "type": "string",
                  "description": "Model that produced it."
                }
              },
              "required": [
                "role",
                "startMs",
                "endMs",
                "label",
                "confidence",
                "model"
              ],
              "additionalProperties": false
            },
            "description": "Detected tone or emotion, by speaker and time."
          },
          "expressionStatus": {
            "type": "string",
            "enum": [
              "NOT_CONFIGURED",
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "Whether tone detection is configured and ran."
          },
          "scorerStatus": {
            "type": "string",
            "enum": [
              "NOT_CONFIGURED",
              "AVAILABLE",
              "UNAVAILABLE"
            ],
            "description": "Whether automatic scoring is configured and ran."
          },
          "sttModel": {
            "type": "string",
            "description": "Speech-to-text model used."
          },
          "scorerModel": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Scoring model used; `null` without scoring."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Problems that may affect the analysis."
          },
          "createdAt": {
            "type": "string",
            "description": "When it was created (ISO 8601)."
          }
        },
        "required": [
          "version",
          "artifactId",
          "checksum",
          "durationMs",
          "segments",
          "metrics",
          "scores",
          "findings",
          "expressions",
          "expressionStatus",
          "scorerStatus",
          "sttModel",
          "scorerModel",
          "warnings",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "QmsAssignmentInput": {
        "type": "object",
        "properties": {
          "reviewerId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Reviewer's user ID; `null` unassigns."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "reviewerId",
          "expectedRevision"
        ]
      },
      "QmsCard": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the scorecard."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "title": {
            "type": "string",
            "description": "Title shown in the LMS."
          },
          "version": {
            "type": "number",
            "description": "Version number."
          },
          "parameters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QmsParameter"
            },
            "description": "Parameters on the scorecard, in order."
          },
          "createdAt": {
            "type": "string",
            "description": "When it was created (ISO 8601)."
          }
        },
        "required": [
          "id",
          "campaignId",
          "title",
          "version",
          "parameters",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "QmsCase": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the quality review."
          },
          "callId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "agentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the agent; `null` if none."
          },
          "agentName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of the agent, as shown in the LMS."
          },
          "campaignName": {
            "type": "string",
            "description": "Name of the campaign, as shown in the LMS."
          },
          "reviewerId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the reviewer; `null` if none."
          },
          "reviewerName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of the reviewer, as shown in the LMS."
          },
          "state": {
            "type": "string",
            "enum": [
              "OPEN",
              "IN_REVIEW",
              "REVIEWED"
            ],
            "description": "Where the review stands: `OPEN` (not started), `IN_REVIEW` (a draft evaluation is saved) or `REVIEWED` (an evaluation was submitted)."
          },
          "analysisStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUESTED",
              "QUEUED",
              "RUNNING",
              "COMPLETED",
              "FAILED"
            ],
            "description": "Status of automatic analysis."
          },
          "analysisError": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why analysis failed; `null` unless it failed."
          },
          "revision": {
            "type": "number",
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "createdAt": {
            "type": "string",
            "description": "When it was created (ISO 8601)."
          },
          "scorePercent": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Final score as a percentage; `null` until scored."
          },
          "criticalFailure": {
            "type": "boolean",
            "description": "Whether a critical parameter failed."
          }
        },
        "required": [
          "id",
          "callId",
          "campaignId",
          "agentId",
          "agentName",
          "campaignName",
          "reviewerId",
          "reviewerName",
          "state",
          "analysisStatus",
          "analysisError",
          "revision",
          "createdAt",
          "scorePercent",
          "criticalFailure"
        ],
        "additionalProperties": false
      },
      "QmsCoachingInput": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "A UUID you create for this submission. Resend the same one to retry safely; a new submission needs a new one."
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 180,
            "description": "Title shown in the LMS."
          },
          "note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 3000,
            "description": "Free-text note."
          },
          "dueAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it is due (ISO 8601)."
          },
          "startMs": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Start, in milliseconds."
          },
          "endMs": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "End, in milliseconds."
          }
        },
        "required": [
          "requestId",
          "title",
          "note",
          "dueAt",
          "startMs",
          "endMs"
        ]
      },
      "QmsCoachingTransitionInput": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "ACKNOWLEDGED",
              "COMPLETED"
            ],
            "description": "Current state of the coaching task."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "state",
          "expectedRevision"
        ]
      },
      "QmsDetail": {
        "type": "object",
        "properties": {
          "item": {
            "description": "The review case.",
            "$ref": "#/components/schemas/QmsCase"
          },
          "card": {
            "description": "Scorecard used.",
            "$ref": "#/components/schemas/QmsCard"
          },
          "analysis": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/QmsAnalysis"
              },
              {
                "type": "null"
              }
            ],
            "description": "Automatic analysis; `null` if not run."
          },
          "evaluations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the evaluation."
                },
                "actorId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the actor."
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "MANUAL",
                    "AUTOMATIC"
                  ],
                  "description": "How the evaluation was made: by a reviewer or by automatic scoring."
                },
                "submitted": {
                  "type": "boolean",
                  "description": "Whether it was submitted (otherwise a draft)."
                },
                "scorePercent": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Final score as a percentage; `null` until scored."
                },
                "criticalFailure": {
                  "type": "boolean",
                  "description": "Whether a critical parameter failed."
                },
                "createdAt": {
                  "type": "string",
                  "description": "When it was created (ISO 8601)."
                },
                "scores": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/QmsScore"
                  },
                  "description": "Score for each parameter."
                },
                "notes": {
                  "type": "string",
                  "description": "Free-text notes."
                }
              },
              "required": [
                "id",
                "actorId",
                "source",
                "submitted",
                "scorePercent",
                "criticalFailure",
                "createdAt",
                "scores",
                "notes"
              ],
              "additionalProperties": false
            },
            "description": "Reviews of the call, newest first."
          },
          "coaching": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the coaching."
                },
                "agentId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the agent."
                },
                "title": {
                  "type": "string",
                  "description": "Title shown in the LMS."
                },
                "note": {
                  "type": "string",
                  "description": "Free-text note."
                },
                "dueAt": {
                  "type": "string",
                  "description": "When it is due (ISO 8601)."
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "OPEN",
                    "ACKNOWLEDGED",
                    "COMPLETED"
                  ],
                  "description": "`OPEN` until the agent acknowledges it, then `ACKNOWLEDGED`, and `COMPLETED` once a manager closes it."
                },
                "revision": {
                  "type": "number",
                  "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
                },
                "startMs": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Start, in milliseconds."
                },
                "endMs": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "End, in milliseconds."
                },
                "createdAt": {
                  "type": "string",
                  "description": "When it was created (ISO 8601)."
                }
              },
              "required": [
                "id",
                "agentId",
                "title",
                "note",
                "dueAt",
                "state",
                "revision",
                "startMs",
                "endMs",
                "createdAt"
              ],
              "additionalProperties": false
            },
            "description": "Coaching tasks from this review."
          },
          "manifest": {
            "description": "The call's recording manifest saved with the review; null without recording access."
          },
          "canReview": {
            "type": "boolean",
            "description": "Whether the viewer may review the call."
          },
          "canManage": {
            "type": "boolean",
            "description": "Whether the viewer may manage scorecards and settings."
          },
          "wrapUp": {
            "description": "The agent's wrap-up of the call, or null."
          }
        },
        "required": [
          "item",
          "card",
          "analysis",
          "evaluations",
          "coaching",
          "manifest",
          "canReview",
          "canManage",
          "wrapUp"
        ],
        "additionalProperties": false
      },
      "QmsEvaluationInput": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "A UUID you create for this submission. Resend the same one to retry safely; a new submission needs a new one."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "submit": {
            "type": "boolean",
            "description": "`true` to submit the evaluation; `false` saves a draft."
          },
          "scores": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QmsScoreInput"
            },
            "description": "Score for each parameter."
          },
          "notes": {
            "default": "",
            "type": "string",
            "maxLength": 5000,
            "description": "Free-text notes."
          }
        },
        "required": [
          "requestId",
          "expectedRevision",
          "submit",
          "scores"
        ]
      },
      "QmsMetrics": {
        "type": "object",
        "properties": {
          "responseGapMedianMs": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Response gap median, in milliseconds."
          },
          "responseGapCount": {
            "type": "number",
            "description": "Number of response gap records."
          },
          "version": {
            "type": "string",
            "description": "Version number."
          },
          "durationMs": {
            "type": "number",
            "description": "Recording length, ms."
          },
          "customerSpeechMs": {
            "type": "number",
            "description": "Customer speech, in milliseconds."
          },
          "agentSpeechMs": {
            "type": "number",
            "description": "Agent speech, in milliseconds."
          },
          "overlapMs": {
            "type": "number",
            "description": "Overlap, in milliseconds."
          },
          "silenceMs": {
            "type": "number",
            "description": "Silence, in milliseconds."
          },
          "longestAgentTurnMs": {
            "type": "number",
            "description": "Longest agent turn, in milliseconds."
          },
          "agentWordsPerMinute": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Agent's speaking pace."
          },
          "customerWordsPerMinute": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Customer's speaking pace."
          },
          "clippedFraction": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "Share of clipped audio per channel (0–1)."
          },
          "silentChannels": {
            "type": "array",
            "items": {
              "type": "boolean"
            },
            "description": "Whether each channel was silent."
          },
          "channelCorrelation": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Similarity of the two channels; high values suggest echo or a mono recording."
          },
          "windows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "startMs": {
                  "type": "number",
                  "description": "Start, in milliseconds."
                },
                "endMs": {
                  "type": "number",
                  "description": "End, in milliseconds."
                },
                "customerActive": {
                  "type": "boolean",
                  "description": "Customer speaking in this window."
                },
                "agentActive": {
                  "type": "boolean",
                  "description": "Agent speaking in this window."
                },
                "customerDb": {
                  "type": "number",
                  "description": "Customer loudness, dBFS."
                },
                "agentDb": {
                  "type": "number",
                  "description": "Agent loudness, dBFS."
                }
              },
              "required": [
                "startMs",
                "endMs",
                "customerActive",
                "agentActive",
                "customerDb",
                "agentDb"
              ],
              "additionalProperties": false
            },
            "description": "Activity and loudness over time."
          }
        },
        "required": [
          "responseGapMedianMs",
          "responseGapCount",
          "version",
          "durationMs",
          "customerSpeechMs",
          "agentSpeechMs",
          "overlapMs",
          "silenceMs",
          "longestAgentTurnMs",
          "agentWordsPerMinute",
          "customerWordsPerMinute",
          "clippedFraction",
          "silentChannels",
          "channelCorrelation",
          "windows"
        ],
        "additionalProperties": false
      },
      "QmsOverview": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "MANAGER",
              "REVIEWER",
              "AGENT"
            ],
            "description": "The acting member's quality role. It decides which reviews `items` holds and whether the setup lists (`cards`, `settings`, `campaigns`, `reviewers`) are filled: only for `MANAGER`."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QmsCase"
            },
            "description": "The records in this response, in the documented order."
          },
          "hasMore": {
            "type": "boolean",
            "description": "`true` when another page follows."
          },
          "cards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QmsCard"
            },
            "description": "Scorecards."
          },
          "settings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "campaignId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the campaign."
                },
                "enabled": {
                  "type": "boolean",
                  "description": "Whether it is turned on."
                },
                "autoAnalyze": {
                  "type": "boolean",
                  "description": "Analyse new recordings automatically."
                },
                "scorecardId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the scorecard."
                },
                "defaultReviewerId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "ID of the default reviewer; `null` if none."
                },
                "revision": {
                  "type": "number",
                  "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
                }
              },
              "required": [
                "campaignId",
                "enabled",
                "autoAnalyze",
                "scorecardId",
                "defaultReviewerId",
                "revision"
              ],
              "additionalProperties": false
            },
            "description": "Quality settings per campaign."
          },
          "campaigns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the campaign."
                },
                "name": {
                  "type": "string",
                  "description": "Name of the campaign, as shown in the LMS."
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            },
            "description": "Campaigns the viewer can see."
          },
          "reviewers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the reviewer."
                },
                "name": {
                  "type": "string",
                  "description": "Name of the reviewer, as shown in the LMS."
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            },
            "description": "Members who can review."
          },
          "report": {
            "type": "object",
            "properties": {
              "reviewed": {
                "type": "number",
                "description": "Calls reviewed."
              },
              "pending": {
                "type": "number",
                "description": "Calls waiting for review."
              },
              "averageScore": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Average score; `null` without reviews."
              },
              "criticalFailures": {
                "type": "number",
                "description": "Reviews with a critical failure."
              }
            },
            "required": [
              "reviewed",
              "pending",
              "averageScore",
              "criticalFailures"
            ],
            "additionalProperties": false,
            "description": "Totals for the period."
          },
          "analysisConfigured": {
            "type": "boolean",
            "description": "Whether automatic analysis is set up."
          }
        },
        "required": [
          "role",
          "items",
          "hasMore",
          "cards",
          "settings",
          "campaigns",
          "reviewers",
          "report",
          "analysisConfigured"
        ],
        "additionalProperties": false
      },
      "QmsParameter": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,47}$",
            "description": "ID of the scorecard parameter."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160,
            "description": "Name of the scorecard parameter, as shown in the LMS."
          },
          "instruction": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "description": "What the reviewer (or the scorer) checks, in plain language."
          },
          "source": {
            "type": "string",
            "enum": [
              "TRANSCRIPT",
              "AUDIO",
              "HYBRID",
              "BUSINESS"
            ],
            "description": "Evidence the parameter is scored from: `TRANSCRIPT`, `AUDIO`, `HYBRID` (both) or `BUSINESS` (CRM facts)."
          },
          "maxScore": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Points for a pass (1–100)."
          },
          "critical": {
            "default": false,
            "description": "Whether failing it fails the whole review.",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "instruction",
          "source",
          "maxScore",
          "critical"
        ],
        "additionalProperties": false
      },
      "QmsParameterInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,47}$",
            "description": "ID of the scorecard parameter."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160,
            "description": "Name of the scorecard parameter, as shown in the LMS."
          },
          "instruction": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "description": "What the reviewer (or the scorer) checks, in plain language."
          },
          "source": {
            "type": "string",
            "enum": [
              "TRANSCRIPT",
              "AUDIO",
              "HYBRID",
              "BUSINESS"
            ],
            "description": "Evidence the parameter is scored from: `TRANSCRIPT`, `AUDIO`, `HYBRID` (both) or `BUSINESS` (CRM facts)."
          },
          "maxScore": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Points for a pass (1–100)."
          },
          "critical": {
            "default": false,
            "description": "Whether failing it fails the whole review.",
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "instruction",
          "source",
          "maxScore"
        ]
      },
      "QmsScore": {
        "type": "object",
        "properties": {
          "parameterId": {
            "type": "string",
            "maxLength": 48,
            "description": "ID of the parameter."
          },
          "result": {
            "type": "string",
            "enum": [
              "PASS",
              "FAIL",
              "NOT_ASSESSABLE",
              "NOT_APPLICABLE"
            ],
            "description": "`PASS`, `FAIL`, `NOT_ASSESSABLE` (no evidence) or `NOT_APPLICABLE`."
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Points given (0–100)."
          },
          "reason": {
            "type": "string",
            "maxLength": 2000,
            "description": "Why, in plain language."
          },
          "evidenceSegmentIds": {
            "maxItems": 30,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 128
            },
            "description": "IDs of the evidence segment records."
          },
          "evidenceStartMs": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Evidence start, in milliseconds."
          },
          "evidenceEndMs": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Evidence end, in milliseconds."
          }
        },
        "required": [
          "parameterId",
          "result",
          "score",
          "reason",
          "evidenceSegmentIds",
          "evidenceStartMs",
          "evidenceEndMs"
        ],
        "additionalProperties": false
      },
      "QmsScorecardInput": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "A UUID you create for this submission. Resend the same one to retry safely; a new submission needs a new one."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160,
            "description": "Title shown in the LMS."
          },
          "parameters": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QmsParameterInput"
            },
            "description": "Parameters on the scorecard, in order."
          }
        },
        "required": [
          "requestId",
          "campaignId",
          "title",
          "parameters"
        ]
      },
      "QmsScoreInput": {
        "type": "object",
        "properties": {
          "parameterId": {
            "type": "string",
            "maxLength": 48,
            "description": "ID of the parameter."
          },
          "result": {
            "type": "string",
            "enum": [
              "PASS",
              "FAIL",
              "NOT_ASSESSABLE",
              "NOT_APPLICABLE"
            ],
            "description": "`PASS`, `FAIL`, `NOT_ASSESSABLE` (no evidence) or `NOT_APPLICABLE`."
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Points given (0–100)."
          },
          "reason": {
            "type": "string",
            "maxLength": 2000,
            "description": "Why, in plain language."
          },
          "evidenceSegmentIds": {
            "maxItems": 30,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 128
            },
            "description": "IDs of the evidence segment records."
          },
          "evidenceStartMs": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Evidence start, in milliseconds."
          },
          "evidenceEndMs": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Evidence end, in milliseconds."
          }
        },
        "required": [
          "parameterId",
          "result",
          "score",
          "reason",
          "evidenceSegmentIds",
          "evidenceStartMs",
          "evidenceEndMs"
        ]
      },
      "QmsSegment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 128,
            "description": "ID of the transcript segment."
          },
          "role": {
            "type": "string",
            "enum": [
              "AGENT",
              "CUSTOMER"
            ],
            "description": "Who spoke: the agent or the customer."
          },
          "startMs": {
            "type": "number",
            "minimum": 0,
            "description": "Start, in milliseconds."
          },
          "endMs": {
            "type": "number",
            "minimum": 0,
            "description": "End, in milliseconds."
          },
          "text": {
            "type": "string",
            "maxLength": 10000,
            "description": "What was said."
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "Model confidence, 0–1."
          }
        },
        "required": [
          "id",
          "role",
          "startMs",
          "endMs",
          "text",
          "confidence"
        ],
        "additionalProperties": false
      },
      "QmsSettingsInput": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether it is turned on."
          },
          "autoAnalyze": {
            "type": "boolean",
            "description": "Analyse new recordings automatically."
          },
          "scorecardId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the scorecard."
          },
          "defaultReviewerId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the default reviewer; `null` if none."
          }
        },
        "required": [
          "campaignId",
          "expectedRevision",
          "enabled",
          "autoAnalyze",
          "scorecardId",
          "defaultReviewerId"
        ]
      },
      "QualityAnalysisState": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the quality review."
          },
          "state": {
            "type": "string",
            "enum": [
              "QUEUED",
              "RUNNING",
              "COMPLETED"
            ],
            "description": "`QUEUED` when just requested; otherwise the analysis already under way or done."
          }
        },
        "required": [
          "id",
          "state"
        ],
        "additionalProperties": false
      },
      "QualitySettingsSaved": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "The settings' new revision."
          }
        },
        "required": [
          "campaignId",
          "revision"
        ],
        "additionalProperties": false
      },
      "ReassignCallingWork": {
        "type": "object",
        "properties": {
          "callId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "teamId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the team."
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the user."
          }
        },
        "required": [
          "callId",
          "expectedRevision",
          "teamId",
          "userId"
        ],
        "additionalProperties": false
      },
      "ReconcileCallAttemptResponse": {
        "type": "object",
        "properties": {
          "accepted": {
            "type": "boolean",
            "const": true,
            "description": "Always `true`: the request was accepted."
          },
          "attemptId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the attempt."
          }
        },
        "required": [
          "accepted",
          "attemptId"
        ],
        "additionalProperties": false
      },
      "RecordingAvailableEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "recording.available",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "recording": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "Recording ID. Download it with the Recordings API using this ID."
                  },
                  "callId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Call the recording belongs to."
                  },
                  "durationSeconds": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Length in seconds; `null` when the telephony provider does not report it."
                  },
                  "contentType": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Audio format, for example `audio/mpeg`."
                  },
                  "availableAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the file became downloadable (ISO 8601)."
                  }
                },
                "required": [
                  "id",
                  "callId",
                  "durationSeconds",
                  "contentType",
                  "availableAt"
                ],
                "additionalProperties": false,
                "description": "The recording."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "recording",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "RecordingConsentPolicyStatus": {
        "type": "string",
        "enum": [
          "ACTIVE",
          "RETIRED"
        ]
      },
      "RecordingConsentPolicyVersionPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordingConsentPolicyVersionResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "type": "null",
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "RecordingConsentPolicyVersionResponse": {
        "type": "object",
        "properties": {
          "approvedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was approved (ISO 8601)."
          },
          "approvedBy": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Who approved the wording."
          },
          "approvedWording": {
            "type": "string",
            "minLength": 10,
            "maxLength": 10000,
            "description": "The consent wording agents read, as approved."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the recording consent policy version."
          },
          "language": {
            "type": "string",
            "minLength": 2,
            "maxLength": 35,
            "description": "Language, as an IETF tag such as `en-IN` or `hi-IN`."
          },
          "policyKey": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{1,99}$",
            "description": "Stable key of the consent policy this is a version of."
          },
          "retiredAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was retired (ISO 8601); `null` if not yet."
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 checksum of the file, in hex."
          },
          "status": {
            "$ref": "#/components/schemas/RecordingConsentPolicyStatus",
            "description": "Current status of the recording consent policy version."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Version number."
          }
        },
        "required": [
          "approvedAt",
          "approvedBy",
          "approvedWording",
          "createdAt",
          "id",
          "language",
          "policyKey",
          "retiredAt",
          "sha256",
          "status",
          "tenantId",
          "version"
        ],
        "additionalProperties": false
      },
      "RecordingManifest": {
        "type": "object",
        "properties": {
          "schema_version": {
            "type": "number",
            "const": 1,
            "description": "Manifest format version."
          },
          "call_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call."
          },
          "call_state": {
            "type": "string",
            "description": "State of the call when the manifest was built, for example `COMPLETED`."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the manifest was built (ISO 8601)."
          },
          "sets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "ID of the recording set."
                },
                "attempt_id": {
                  "type": "string",
                  "description": "ID of the call attempt it recorded."
                },
                "state": {
                  "type": "string",
                  "description": "Storage state, for example `ACKNOWLEDGED`."
                },
                "attribution": {
                  "type": "string",
                  "enum": [
                    "CONFIRMED_TWO_PARTY",
                    "REVIEW_REQUIRED"
                  ],
                  "description": "Whether each channel's speaker is confirmed."
                },
                "warnings": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Quality warnings, for example `AUDIO_CONTINUITY_NOT_CERTIFIED`."
                },
                "artifacts": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Recording ID; pass it to Download a review recording."
                      },
                      "type": {
                        "type": "string",
                        "description": "Kind of recording, for example `STEREO_MASTER`."
                      },
                      "state": {
                        "type": "string",
                        "description": "Storage state, for example `ACKNOWLEDGED`."
                      },
                      "format": {
                        "type": "string",
                        "description": "Audio format, for example `wav`."
                      },
                      "sample_rate": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "description": "Samples per second."
                      },
                      "channels": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "description": "Number of audio channels."
                      },
                      "checksum": {
                        "type": "string",
                        "description": "SHA-256 checksum of the file, in hex."
                      },
                      "byte_length": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "File size in bytes."
                      },
                      "start_offset_ms": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Where it starts, in milliseconds from the start of the call."
                      },
                      "participant_id": {
                        "description": "Speaker, for single-party recordings.",
                        "type": "string"
                      },
                      "segment_id": {
                        "description": "Segment it belongs to, if any.",
                        "type": "string"
                      },
                      "playable": {
                        "type": "boolean",
                        "description": "Whether it can be downloaded and played."
                      },
                      "channel_roles": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Speaker on each channel, for example `[\"CUSTOMER\", \"AGENT\"]`."
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "state",
                      "format",
                      "sample_rate",
                      "channels",
                      "checksum",
                      "byte_length",
                      "start_offset_ms",
                      "playable",
                      "channel_roles"
                    ],
                    "additionalProperties": false
                  },
                  "description": "Recordings in the set."
                },
                "segments": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "ID of the segment."
                      },
                      "participant_id": {
                        "type": "string",
                        "description": "Speaker in the segment."
                      },
                      "role": {
                        "type": "string",
                        "description": "Speaker's role, for example `AGENT`."
                      },
                      "start_offset_ms": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Start, in milliseconds from the start of the call."
                      },
                      "started_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When it started (ISO 8601)."
                      },
                      "ended_at": {
                        "description": "When it ended (ISO 8601), once it has.",
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "id",
                      "participant_id",
                      "role",
                      "start_offset_ms",
                      "started_at"
                    ],
                    "additionalProperties": false
                  },
                  "description": "Who spoke when, if known."
                }
              },
              "required": [
                "id",
                "attempt_id",
                "state",
                "attribution",
                "warnings",
                "artifacts",
                "segments"
              ],
              "additionalProperties": false
            },
            "description": "Recording sets, one per call attempt."
          }
        },
        "required": [
          "schema_version",
          "call_id",
          "call_state",
          "generated_at",
          "sets"
        ],
        "additionalProperties": false
      },
      "ReplaySourceRecordBody": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 100,
            "pattern": "^[A-Z][A-Z0-9_:-]*$",
            "description": "Your reason code, in upper case (for example `CRM_SYNC`). Kept in the lead's history."
          },
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the revision."
          },
          "versionSelection": {
            "type": "string",
            "enum": [
              "ORIGINAL",
              "CURRENT"
            ],
            "description": "Replay the `ORIGINAL` payload or the `CURRENT` corrected revision."
          }
        },
        "required": [
          "reason",
          "versionSelection"
        ],
        "additionalProperties": false
      },
      "ReplaySourceRecordResponse": {
        "type": "object",
        "properties": {
          "leadId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the lead; `null` if none."
          },
          "reasonCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Machine-readable reason. Branch on this, not on the summary."
          },
          "sourceRecordId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source record."
          },
          "sourceRecordRevisionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source record revision."
          },
          "status": {
            "type": "string",
            "enum": [
              "MATERIALIZED",
              "DUPLICATE",
              "NEEDS_MAPPING",
              "NEEDS_ROUTING"
            ],
            "description": "Current status of the source."
          },
          "validationIssues": {
            "type": "array",
            "items": {},
            "description": "Problems found when the record was validated, if any."
          }
        },
        "required": [
          "leadId",
          "reasonCode",
          "sourceRecordId",
          "sourceRecordRevisionId",
          "status",
          "validationIssues"
        ],
        "additionalProperties": false
      },
      "RoutingDraft": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the routing draft."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "name": {
            "type": "string",
            "description": "Name of the routing draft, as shown in the LMS."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source connection."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ],
            "description": "`ARCHIVED` drafts are kept for history."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceRoutingRule"
            },
            "description": "Rules, checked in `priority` order; the first match wins."
          }
        },
        "required": [
          "id",
          "tenantId",
          "name",
          "revision",
          "sourceConnectionId",
          "status",
          "createdAt",
          "updatedAt",
          "rules"
        ],
        "additionalProperties": false
      },
      "RoutingVersion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the routing version."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "routingRulesetId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the routing draft this was published from."
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Version number, from 1."
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceRoutingRule"
            },
            "description": "Rules, checked in `priority` order; the first match wins."
          },
          "defaultCampaignId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Campaign for leads no rule matches; `null` leaves them in Needs routing."
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was published (ISO 8601)."
          },
          "publishedBy": {
            "type": "string",
            "format": "uuid",
            "description": "User ID of the member who published it."
          }
        },
        "required": [
          "id",
          "tenantId",
          "routingRulesetId",
          "version",
          "rules",
          "defaultCampaignId",
          "publishedAt",
          "publishedBy"
        ],
        "additionalProperties": false
      },
      "SalesEscalationAcknowledged": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the escalation."
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      },
      "SalesEscalationAcknowledgeInput": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "expectedRevision"
        ]
      },
      "SalesOverview": {
        "type": "object",
        "properties": {
          "dispositions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "description": "Stable machine key. Unlike the label, it never changes."
                },
                "label": {
                  "type": "string",
                  "description": "Display label."
                }
              },
              "required": [
                "key",
                "label"
              ],
              "additionalProperties": false
            },
            "description": "Campaign dispositions."
          },
          "managers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the manager."
                },
                "name": {
                  "type": "string",
                  "description": "Name of the manager, as shown in the LMS."
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            },
            "description": "Sales managers."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "policy": {
            "description": "Sales stage policy.",
            "$ref": "#/components/schemas/SalesPolicyInput"
          },
          "calls": {
            "type": "number",
            "description": "Calls in the period."
          },
          "contactedLeads": {
            "type": "number",
            "description": "Leads reached."
          },
          "qualifiedLeads": {
            "type": "number",
            "description": "Leads that reached a qualified disposition."
          },
          "appointmentLeads": {
            "type": "number",
            "description": "Leads with an appointment disposition."
          },
          "convertedLeads": {
            "type": "number",
            "description": "Leads converted."
          },
          "escalations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the escalation."
                },
                "callId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the call."
                },
                "leadId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the lead."
                },
                "leadName": {
                  "default": null,
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Name of the lead, as shown in the LMS."
                },
                "ownerId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "ID of the owner; `null` if none."
                },
                "ownerName": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Name of the owner, as shown in the LMS."
                },
                "dueAt": {
                  "type": "string",
                  "description": "When it is due (ISO 8601)."
                },
                "status": {
                  "type": "string",
                  "description": "Current status of the escalation."
                },
                "revision": {
                  "type": "number",
                  "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
                }
              },
              "required": [
                "id",
                "callId",
                "leadId",
                "leadName",
                "ownerId",
                "ownerName",
                "dueAt",
                "status",
                "revision"
              ],
              "additionalProperties": false
            },
            "description": "Escalations raised."
          }
        },
        "required": [
          "dispositions",
          "managers",
          "campaignId",
          "policy",
          "calls",
          "contactedLeads",
          "qualifiedLeads",
          "appointmentLeads",
          "convertedLeads",
          "escalations"
        ],
        "additionalProperties": false
      },
      "SalesPolicyInput": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "overdueMinutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 43200,
            "description": "Overdue, in minutes."
          },
          "escalationOwnerId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the escalation owner; `null` if none."
          },
          "stages": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "dispositionKey": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80,
                  "description": "Key of the call outcome (disposition), as set up on the campaign."
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "QUALIFIED",
                    "APPOINTMENT",
                    "CONVERTED"
                  ],
                  "description": "`QUALIFIED`, `APPOINTMENT` or `CONVERTED`."
                }
              },
              "required": [
                "dispositionKey",
                "stage"
              ],
              "additionalProperties": false
            },
            "description": "Lead stage to set for each disposition."
          }
        },
        "required": [
          "campaignId",
          "expectedRevision",
          "overdueMinutes",
          "escalationOwnerId",
          "stages"
        ],
        "additionalProperties": false
      },
      "SalesPolicyInputInput": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "overdueMinutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 43200,
            "description": "Overdue, in minutes."
          },
          "escalationOwnerId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the escalation owner; `null` if none."
          },
          "stages": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "dispositionKey": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80,
                  "description": "Key of the call outcome (disposition), as set up on the campaign."
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "QUALIFIED",
                    "APPOINTMENT",
                    "CONVERTED"
                  ],
                  "description": "`QUALIFIED`, `APPOINTMENT` or `CONVERTED`."
                }
              },
              "required": [
                "dispositionKey",
                "stage"
              ]
            },
            "description": "Lead stage to set for each disposition."
          }
        },
        "required": [
          "campaignId",
          "expectedRevision",
          "overdueMinutes",
          "escalationOwnerId",
          "stages"
        ]
      },
      "SaveBreakSettings": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read; `409` if it changed since."
          },
          "reasons": {
            "minItems": 1,
            "maxItems": 30,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakReason"
            },
            "description": "The complete new list (1–30)."
          }
        },
        "required": [
          "expectedRevision",
          "reasons"
        ],
        "additionalProperties": false
      },
      "SaveCallingCohort": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Name of the calling cohort, as shown in the LMS."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether it is turned on."
          },
          "batchId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the batch; `null` if none."
          },
          "leadIds": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of the lead records."
          }
        },
        "required": [
          "expectedRevision",
          "name",
          "enabled",
          "batchId",
          "leadIds"
        ],
        "additionalProperties": false
      },
      "SaveCampaignCustomerForm": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "fields": {
            "$ref": "#/components/schemas/CustomerFieldsInput",
            "description": "The fields, in display order."
          }
        },
        "required": [
          "expectedRevision",
          "fields"
        ],
        "additionalProperties": false
      },
      "SaveCdrTemplate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the call detail record template."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Name of the call detail record template, as shown in the LMS."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "PRIVATE",
              "PROCESS"
            ],
            "description": "Who can see it, from the values below."
          },
          "definition": {
            "$ref": "#/components/schemas/CdrDefinitionInput",
            "description": "What the report contains: columns, filters and time basis."
          }
        },
        "required": [
          "id",
          "expectedRevision",
          "name",
          "visibility",
          "definition"
        ],
        "additionalProperties": false
      },
      "SaveContactPermission": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "GRANTED",
              "WITHDRAWN"
            ],
            "description": "Current status of the contact permission."
          },
          "evidence": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000,
            "description": "How the permission was recorded."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          }
        },
        "required": [
          "status",
          "evidence",
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "SaveCustomerFieldValues": {
        "type": "object",
        "properties": {
          "campaignId": {
            "description": "Campaign whose form the values belong to; defaults to the lead's campaign.",
            "type": "string",
            "format": "uuid"
          },
          "expectedUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The lead's `updatedAt` from your last read; `409` if it changed since."
          },
          "formRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The form `revision` you built the values against; `409` if the form changed since."
          },
          "values": {
            "description": "Values keyed by field key. Unknown and archived fields are refused.",
            "$ref": "#/components/schemas/CustomerFieldValues"
          }
        },
        "required": [
          "expectedUpdatedAt",
          "formRevision",
          "values"
        ],
        "additionalProperties": false
      },
      "SaveDialerPolicy": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read; `409` if it changed since."
          },
          "policy": {
            "description": "The complete new policy.",
            "$ref": "#/components/schemas/DialerPolicyInput"
          }
        },
        "required": [
          "expectedRevision",
          "policy"
        ],
        "additionalProperties": false
      },
      "SegmentationCondition": {
        "type": "object",
        "properties": {
          "field": {
            "description": "Lead field the condition checks.",
            "$ref": "#/components/schemas/SegmentationField"
          },
          "operator": {
            "description": "How the field is compared, from the values below.",
            "$ref": "#/components/schemas/OwnershipOperator"
          },
          "value": {
            "$ref": "#/components/schemas/OwnershipConditionValue",
            "description": "The value."
          }
        },
        "required": [
          "field",
          "operator"
        ],
        "additionalProperties": false
      },
      "SegmentationField": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "lead.fullName",
              "lead.companyName",
              "lead.productInterest",
              "lead.inquirySummary",
              "lead.city",
              "lead.state",
              "lead.country",
              "lead.priority",
              "acquisition.provider",
              "acquisition.channel",
              "acquisition.sourceDefinitionKey",
              "campaign.id"
            ]
          },
          {
            "type": "string",
            "pattern": "^attributes\\.[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$"
          }
        ]
      },
      "SegmentationRulesetDetailResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "currentVersion": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of the published version; `null` before the first publish."
          },
          "currentVersionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the current version; `null` if none."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the segmentation ruleset."
          },
          "name": {
            "type": "string",
            "description": "Name of the segmentation ruleset, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "status": {
            "$ref": "#/components/schemas/OwnershipConfigurationStatus",
            "description": "Current status of the segmentation ruleset."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "defaultSegmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the default segment; `null` if none."
          },
          "rules": {
            "$ref": "#/components/schemas/LeadSegmentationRulesV1",
            "description": "Rules, checked in `priority` order; the first match wins."
          },
          "currentVersionData": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SegmentationVersionResponse"
              },
              {
                "type": "null"
              }
            ],
            "description": "The published version's content; `null` before the first publish."
          }
        },
        "required": [
          "createdAt",
          "currentVersion",
          "currentVersionId",
          "id",
          "name",
          "processId",
          "revision",
          "status",
          "tenantId",
          "updatedAt",
          "defaultSegmentId",
          "rules",
          "currentVersionData"
        ],
        "additionalProperties": false
      },
      "SegmentationRulesetPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SegmentationRulesetResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "SegmentationRulesetResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "currentVersion": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of the published version; `null` before the first publish."
          },
          "currentVersionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the current version; `null` if none."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the segmentation ruleset."
          },
          "name": {
            "type": "string",
            "description": "Name of the segmentation ruleset, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Revision number, increased on every change. Send it back as `expectedRevision` when you update."
          },
          "status": {
            "$ref": "#/components/schemas/OwnershipConfigurationStatus",
            "description": "Current status of the segmentation ruleset."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "defaultSegmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the default segment; `null` if none."
          },
          "rules": {
            "$ref": "#/components/schemas/LeadSegmentationRulesV1",
            "description": "Rules, checked in `priority` order; the first match wins."
          }
        },
        "required": [
          "createdAt",
          "currentVersion",
          "currentVersionId",
          "id",
          "name",
          "processId",
          "revision",
          "status",
          "tenantId",
          "updatedAt",
          "defaultSegmentId",
          "rules"
        ],
        "additionalProperties": false
      },
      "SegmentationVersionResponse": {
        "type": "object",
        "properties": {
          "defaultSegmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the default segment; `null` if none."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the segmentation version."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was published (ISO 8601)."
          },
          "publishedBy": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "User ID of the member who published it."
          },
          "rules": {
            "$ref": "#/components/schemas/LeadSegmentationRulesV1",
            "description": "Rules, checked in `priority` order; the first match wins."
          },
          "rulesetId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the ruleset."
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "Version number."
          }
        },
        "required": [
          "defaultSegmentId",
          "id",
          "processId",
          "publishedAt",
          "publishedBy",
          "rules",
          "rulesetId",
          "version"
        ],
        "additionalProperties": false
      },
      "SegmentColorToken": {
        "type": "string",
        "enum": [
          "SLATE",
          "AMBER",
          "LIME",
          "ROSE",
          "SKY",
          "VIOLET"
        ]
      },
      "SemanticStageCategory": {
        "type": "string",
        "enum": [
          "NEW",
          "OPEN",
          "CONTACTED",
          "QUALIFIED",
          "CONVERTED",
          "LOST",
          "DISQUALIFIED"
        ]
      },
      "SequenceCompletedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "sequence.completed",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "sequence": {
                "description": "The automated sequence.",
                "$ref": "#/components/schemas/PublicNamedRef"
              },
              "enrollmentId": {
                "type": "string",
                "format": "uuid",
                "description": "ID of this lead's run through the sequence."
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "completed",
                  "exited",
                  "stopped"
                ],
                "description": "`completed` (every step ran), `exited` (an exit rule matched, for example the lead replied) or `stopped` (someone stopped it)."
              },
              "completedAt": {
                "type": "string",
                "format": "date-time",
                "description": "When the run ended (ISO 8601)."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "sequence",
              "enrollmentId",
              "outcome",
              "completedAt",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "SetLeadSegmentRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 100,
            "pattern": "^[A-Z][A-Z0-9_:-]*$",
            "description": "Your reason code, in upper case (for example `CRM_SYNC`). Kept in the lead's history."
          },
          "segmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the segment; `null` if none."
          }
        },
        "required": [
          "reason",
          "segmentId"
        ],
        "additionalProperties": false
      },
      "SlaBreachedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID. Stable across retries and replays, and sent as the `webhook-id` header: use it to de-duplicate."
          },
          "version": {
            "type": "number",
            "const": 1,
            "description": "Payload version of this event type."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When the change happened (ISO 8601, UTC)."
          },
          "workspace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Slug of the workspace the event belongs to, as in its LMS web address."
          },
          "test": {
            "description": "Present and `true` only on events sent with \"Send test event\".",
            "type": "boolean",
            "const": true
          },
          "type": {
            "type": "string",
            "const": "sla.breached",
            "description": "Event type."
          },
          "data": {
            "type": "object",
            "properties": {
              "sla": {
                "type": "object",
                "properties": {
                  "policy": {
                    "description": "The SLA policy that was missed.",
                    "$ref": "#/components/schemas/PublicNamedRef"
                  },
                  "metric": {
                    "type": "string",
                    "enum": [
                      "first_response",
                      "follow_up",
                      "callback",
                      "stage_age"
                    ],
                    "description": "What was late: `first_response` (first contact), `follow_up`, `callback`, or `stage_age` (too long in one stage)."
                  },
                  "targetAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When it was due (ISO 8601)."
                  },
                  "breachedAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When LMS recorded the breach (ISO 8601)."
                  },
                  "ownerUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "User ID of the member responsible at the time; `null` if unassigned."
                  }
                },
                "required": [
                  "policy",
                  "metric",
                  "targetAt",
                  "breachedAt",
                  "ownerUserId"
                ],
                "additionalProperties": false,
                "description": "The missed target."
              },
              "lead": {
                "description": "Snapshot of the lead when the event was published, after the change.",
                "$ref": "#/components/schemas/PublicLead"
              }
            },
            "required": [
              "sla",
              "lead"
            ],
            "additionalProperties": false,
            "description": "What happened. Fields depend on the event type."
          }
        },
        "required": [
          "id",
          "version",
          "timestamp",
          "workspace",
          "type",
          "data"
        ],
        "additionalProperties": false
      },
      "SourceFieldMappingRule": {
        "type": "object",
        "properties": {
          "sourceField": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Field name in the incoming payload."
          },
          "targetField": {
            "description": "Lead field it fills.",
            "$ref": "#/components/schemas/SourceFieldMappingTarget"
          },
          "required": {
            "type": "boolean",
            "description": "Whether the field must be present."
          },
          "transform": {
            "type": "string",
            "enum": [
              "NONE",
              "TRIM",
              "LOWERCASE",
              "UPPERCASE"
            ],
            "description": "Clean-up applied to the value before it is saved."
          }
        },
        "required": [
          "sourceField",
          "targetField",
          "required",
          "transform"
        ],
        "additionalProperties": false
      },
      "SourceFieldMappingTarget": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "lead.fullName",
              "lead.companyName",
              "lead.productInterest",
              "lead.inquirySummary",
              "lead.city",
              "lead.state",
              "lead.country",
              "identity.phone",
              "identity.email",
              "identity.whatsapp",
              "identity.providerProfile",
              "attribution.channel",
              "attribution.externalAccountId",
              "attribution.externalAccountName",
              "attribution.externalCampaignId",
              "attribution.externalCampaignName",
              "attribution.externalAdGroupId",
              "attribution.externalAdGroupName",
              "attribution.externalAdId",
              "attribution.externalAdName",
              "attribution.externalFormId",
              "attribution.externalFormName",
              "attribution.utmSource",
              "attribution.utmMedium",
              "attribution.utmCampaign",
              "attribution.utmTerm",
              "attribution.utmContent",
              "attribution.clickId",
              "attribution.landingPage",
              "attribution.referrer"
            ]
          },
          {
            "type": "string",
            "pattern": "^routing\\..+$"
          },
          {
            "type": "string",
            "pattern": "^attributes\\..+$"
          }
        ]
      },
      "SourceHealthDirectoryResponse": {
        "type": "object",
        "properties": {
          "hasNextPage": {
            "type": "boolean",
            "description": "Whether it has next page."
          },
          "hasSources": {
            "type": "boolean",
            "description": "Whether it has sources."
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "acceptedCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of accepted records."
                },
                "checkpointPresent": {
                  "type": "boolean",
                  "description": "Whether LMS has saved a polling position for this source."
                },
                "connectionStatus": {
                  "type": "string",
                  "description": "Whether the connection is `ACTIVE`, `PAUSED` or `ARCHIVED`."
                },
                "connectorFailedCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of connector failed records."
                },
                "connectorReceiptCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of connector receipt records."
                },
                "duplicateCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of duplicate records."
                },
                "failedCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of failed records."
                },
                "healthStatus": {
                  "type": "string",
                  "description": "Overall health: `HEALTHY`, `DEGRADED` or `FAILING`."
                },
                "lastFailureCode": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Code of the most recent failure; `null` if none."
                },
                "lastFailureSummary": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Plain-language summary of the most recent failure; `null` if none."
                },
                "lastIntakeMode": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "How the most recent lead arrived: pushed by the sender or polled by LMS."
                },
                "lastReceivedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When it was last received (ISO 8601); `null` if not yet."
                },
                "lastSucceededAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When it was last succeeded (ISO 8601); `null` if not yet."
                },
                "needsMappingCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of needs mapping records."
                },
                "needsRoutingCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of needs routing records."
                },
                "pollRunCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of poll run records."
                },
                "rawReceiptCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of raw receipt records."
                },
                "rejectedCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of rejected records."
                },
                "sourceConnectionId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the source connection."
                },
                "sourceConnectionName": {
                  "type": "string",
                  "description": "Name of the source connection, as shown in the LMS."
                },
                "sourceDefinitionKey": {
                  "type": "string",
                  "description": "Source type key, for example `meta_lead_ads` (see List source types)."
                },
                "status": {
                  "type": "string",
                  "description": "Current status of the source health."
                },
                "sourceDefinitionName": {
                  "type": "string",
                  "description": "Name of the source definition, as shown in the LMS."
                }
              },
              "required": [
                "acceptedCount",
                "checkpointPresent",
                "connectionStatus",
                "connectorFailedCount",
                "connectorReceiptCount",
                "duplicateCount",
                "failedCount",
                "healthStatus",
                "lastFailureCode",
                "lastFailureSummary",
                "lastIntakeMode",
                "lastReceivedAt",
                "lastSucceededAt",
                "needsMappingCount",
                "needsRoutingCount",
                "pollRunCount",
                "rawReceiptCount",
                "rejectedCount",
                "sourceConnectionId",
                "sourceConnectionName",
                "sourceDefinitionKey",
                "status",
                "sourceDefinitionName"
              ],
              "additionalProperties": false
            },
            "description": "The records in this response, in the documented order."
          }
        },
        "required": [
          "hasNextPage",
          "hasSources",
          "items"
        ],
        "additionalProperties": false
      },
      "SourceHealthResponse": {
        "type": "object",
        "properties": {
          "acceptedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of accepted records."
          },
          "checkpointPresent": {
            "type": "boolean",
            "description": "Whether LMS has saved a polling position for this source."
          },
          "connectionStatus": {
            "type": "string",
            "description": "Whether the connection is `ACTIVE`, `PAUSED` or `ARCHIVED`."
          },
          "connectorFailedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of connector failed records."
          },
          "connectorReceiptCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of connector receipt records."
          },
          "duplicateCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of duplicate records."
          },
          "failedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of failed records."
          },
          "healthStatus": {
            "type": "string",
            "description": "Overall health: `HEALTHY`, `DEGRADED` or `FAILING`."
          },
          "lastFailureCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Code of the most recent failure; `null` if none."
          },
          "lastFailureSummary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Plain-language summary of the most recent failure; `null` if none."
          },
          "lastIntakeMode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the most recent lead arrived: pushed by the sender or polled by LMS."
          },
          "lastReceivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was last received (ISO 8601); `null` if not yet."
          },
          "lastSucceededAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was last succeeded (ISO 8601); `null` if not yet."
          },
          "needsMappingCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of needs mapping records."
          },
          "needsRoutingCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of needs routing records."
          },
          "pollRunCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of poll run records."
          },
          "rawReceiptCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of raw receipt records."
          },
          "rejectedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of rejected records."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source connection."
          },
          "sourceConnectionName": {
            "type": "string",
            "description": "Name of the source connection, as shown in the LMS."
          },
          "sourceDefinitionKey": {
            "type": "string",
            "description": "Source type key, for example `meta_lead_ads` (see List source types)."
          },
          "status": {
            "type": "string",
            "description": "Current status of the source health."
          }
        },
        "required": [
          "acceptedCount",
          "checkpointPresent",
          "connectionStatus",
          "connectorFailedCount",
          "connectorReceiptCount",
          "duplicateCount",
          "failedCount",
          "healthStatus",
          "lastFailureCode",
          "lastFailureSummary",
          "lastIntakeMode",
          "lastReceivedAt",
          "lastSucceededAt",
          "needsMappingCount",
          "needsRoutingCount",
          "pollRunCount",
          "rawReceiptCount",
          "rejectedCount",
          "sourceConnectionId",
          "sourceConnectionName",
          "sourceDefinitionKey",
          "status"
        ],
        "additionalProperties": false
      },
      "SourceRecordDetailResponse": {
        "type": "object",
        "properties": {
          "connectionName": {
            "type": "string",
            "description": "Source name."
          },
          "leadId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "Lead created or updated from it; `null` if none yet."
          },
          "lineage": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "ingestionBatchId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Delivery batch."
                  },
                  "rawReceiptId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Raw receipt, if kept."
                  },
                  "sourceDeliveryId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Delivery it arrived in."
                  }
                },
                "required": [
                  "ingestionBatchId",
                  "rawReceiptId",
                  "sourceDeliveryId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the record came in."
          },
          "processingState": {
            "type": "string",
            "description": "Where it is in intake: `RECEIVED`, `VALIDATED`, `MAPPED`, `ROUTED`, `MATERIALIZED_AS_LEAD`, or a stop: `NEEDS_MAPPING`, `NEEDS_ROUTING`, `INVALID`, `PROCESSING_FAILED`."
          },
          "providerRecordId": {
            "type": "string",
            "description": "The record's ID in the sending system."
          },
          "sourceConnectionId": {
            "type": "string",
            "format": "uuid",
            "description": "Source ID."
          },
          "sourceDefinitionKey": {
            "type": "string",
            "description": "Source type key, for example `meta_lead_ads`."
          },
          "sourceRecordId": {
            "type": "string",
            "format": "uuid",
            "description": "Source record ID."
          },
          "revisions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "Revision ID."
                },
                "revisionSequence": {
                  "type": "number",
                  "description": "1 for the first version, then 2, 3…"
                },
                "validationResult": {
                  "type": "string",
                  "description": "Result of validating this version."
                },
                "platformReceivedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When LMS received it."
                },
                "providerSubmittedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When it was submitted, per the sending system."
                },
                "mappingVersionId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Field mapping version applied."
                },
                "providerSchemaVersion": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Sending system's payload version."
                },
                "extractedFields": {
                  "type": "object",
                  "additionalProperties": {},
                  "description": "Lead fields extracted by the mapping."
                }
              },
              "required": [
                "id",
                "revisionSequence",
                "validationResult",
                "platformReceivedAt",
                "providerSubmittedAt",
                "mappingVersionId",
                "providerSchemaVersion",
                "extractedFields"
              ],
              "additionalProperties": false
            },
            "description": "Every version of the record received, oldest first."
          },
          "routingDecisions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "Decision ID."
                },
                "decisionOrigin": {
                  "type": "string",
                  "description": "`AUTOMATIC` (routing rules) or `MANUAL` (routed by hand)."
                },
                "decisionResult": {
                  "type": "string",
                  "description": "`ROUTED`, `NO_MATCH`, `AMBIGUOUS` (several rules matched) or `INELIGIBLE`."
                },
                "reasonCode": {
                  "type": "string",
                  "description": "Machine-readable reason."
                },
                "occurredAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When it was decided."
                },
                "routingVersionId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Routing ruleset version used."
                },
                "selectedCampaignId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Campaign chosen; `null` if none."
                }
              },
              "required": [
                "id",
                "decisionOrigin",
                "decisionResult",
                "reasonCode",
                "occurredAt",
                "routingVersionId",
                "selectedCampaignId"
              ],
              "additionalProperties": false
            },
            "description": "Every routing decision, oldest first."
          },
          "replayAttempts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "Replay ID."
                },
                "outcome": {
                  "type": "string",
                  "description": "Result of the replay."
                },
                "reason": {
                  "type": "string",
                  "description": "Why it was replayed."
                },
                "requestedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When the replay was requested."
                },
                "resultingLeadId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Lead it produced; `null` if none."
                }
              },
              "required": [
                "id",
                "outcome",
                "reason",
                "requestedAt",
                "resultingLeadId"
              ],
              "additionalProperties": false
            },
            "description": "Replays of the record, oldest first."
          }
        },
        "required": [
          "connectionName",
          "leadId",
          "lineage",
          "processingState",
          "providerRecordId",
          "sourceConnectionId",
          "sourceDefinitionKey",
          "sourceRecordId",
          "revisions",
          "routingDecisions",
          "replayAttempts"
        ],
        "additionalProperties": false
      },
      "SourceRecordPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the source."
                },
                "providerRecordId": {
                  "type": "string",
                  "description": "The sender's own ID for the record."
                },
                "sourceConnectionId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the source connection."
                },
                "processingState": {
                  "type": "string",
                  "enum": [
                    "NEEDS_MAPPING",
                    "NEEDS_ROUTING",
                    "INVALID",
                    "PROCESSING_FAILED"
                  ]
                },
                "currentRevisionSequence": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "description": "Number of the latest revision received for this record."
                },
                "firstReceivedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When it was first received (ISO 8601)."
                },
                "lastReceivedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When it was last received (ISO 8601)."
                },
                "providerSubmittedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When the sender says it was submitted; `null` if not given."
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When it was created (ISO 8601)."
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
                }
              },
              "required": [
                "id",
                "providerRecordId",
                "sourceConnectionId",
                "processingState",
                "currentRevisionSequence",
                "firstReceivedAt",
                "lastReceivedAt",
                "providerSubmittedAt",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "SourceRoutingCondition": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Name of the field it applies to."
          },
          "operator": {
            "type": "string",
            "enum": [
              "EQUALS",
              "IN"
            ],
            "description": "How `value` is compared: `EQUALS` one value or `IN` a list."
          },
          "value": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              },
              {
                "minItems": 1,
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                }
              }
            ],
            "description": "The value."
          }
        },
        "required": [
          "field",
          "operator",
          "value"
        ],
        "additionalProperties": false
      },
      "SourceRoutingRule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the source routing rule."
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "description": "Evaluation order: lower numbers are checked first, and the first match wins."
          },
          "campaignId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the campaign."
          },
          "all": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceRoutingCondition"
            },
            "description": "Conditions that must all match for the rule to apply."
          }
        },
        "required": [
          "id",
          "priority",
          "campaignId",
          "all"
        ],
        "additionalProperties": false
      },
      "StageResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "displayOrder": {
            "type": "integer",
            "minimum": 0,
            "description": "Position in lists; lower numbers come first."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the stage."
          },
          "isActive": {
            "type": "boolean",
            "description": "Whether it is active."
          },
          "isInitial": {
            "type": "boolean",
            "description": "Whether it is initial."
          },
          "name": {
            "type": "string",
            "description": "Name of the stage, as shown in the LMS."
          },
          "processId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the process."
          },
          "semanticCategory": {
            "$ref": "#/components/schemas/SemanticStageCategory"
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "createdAt",
          "displayOrder",
          "id",
          "isActive",
          "isInitial",
          "name",
          "processId",
          "semanticCategory",
          "tenantId",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "TeamDirectoryPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamMemberLabelResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "TeamLookupQuery": {
        "type": "object",
        "properties": {
          "teamIds": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of the team records."
          }
        },
        "required": [
          "teamIds"
        ],
        "additionalProperties": false
      },
      "TeamMemberLabelResponse": {
        "type": "object",
        "properties": {
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160,
            "description": "Name shown in the LMS."
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the user."
          }
        },
        "required": [
          "displayName",
          "userId"
        ],
        "additionalProperties": false
      },
      "TeamMemberLookupQuery": {
        "type": "object",
        "properties": {
          "userIds": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of the user records."
          }
        },
        "required": [
          "userIds"
        ],
        "additionalProperties": false
      },
      "TeamMemberPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamMemberResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "TeamMemberResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "displayName": {
            "type": "string",
            "description": "Name shown in the LMS."
          },
          "status": {
            "$ref": "#/components/schemas/TeamMemberStatus",
            "description": "Current status of the team member."
          },
          "teamId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the team."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the user."
          }
        },
        "required": [
          "createdAt",
          "displayName",
          "status",
          "teamId",
          "updatedAt",
          "userId"
        ],
        "additionalProperties": false
      },
      "TeamMembershipBulkLookupQuery": {
        "type": "object",
        "properties": {
          "memberships": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "teamId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the team."
                },
                "userId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the user."
                }
              },
              "required": [
                "teamId",
                "userId"
              ],
              "additionalProperties": false
            },
            "description": "Team and member pairs to look up."
          }
        },
        "required": [
          "memberships"
        ],
        "additionalProperties": false
      },
      "TeamMemberStatus": {
        "type": "string",
        "enum": [
          "ACTIVE",
          "INACTIVE"
        ]
      },
      "TeamResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text description."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the team."
          },
          "name": {
            "type": "string",
            "description": "Name of the team, as shown in the LMS."
          },
          "status": {
            "$ref": "#/components/schemas/TeamStatus",
            "description": "Current status of the team."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          }
        },
        "required": [
          "createdAt",
          "description",
          "id",
          "name",
          "status",
          "tenantId",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "TeamStatus": {
        "type": "string",
        "enum": [
          "ACTIVE",
          "ARCHIVED"
        ]
      },
      "TeamSummaryPageResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamSummaryResponse"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "description": "Teams matching the filters, across all pages."
          }
        },
        "required": [
          "items",
          "nextCursor",
          "total"
        ],
        "additionalProperties": false
      },
      "TeamSummaryResponse": {
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601)."
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text description."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the team."
          },
          "name": {
            "type": "string",
            "description": "Name of the team, as shown in the LMS."
          },
          "status": {
            "$ref": "#/components/schemas/TeamStatus",
            "description": "Current status of the team."
          },
          "tenantId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the workspace."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601). Send it back as `expectedUpdatedAt` when you update."
          },
          "memberCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of member records."
          }
        },
        "required": [
          "createdAt",
          "description",
          "id",
          "name",
          "status",
          "tenantId",
          "updatedAt",
          "memberCount"
        ],
        "additionalProperties": false
      },
      "TenantMember": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "description": "When the invitation or membership was created (ISO 8601)."
              },
              "displayName": {
                "type": "string",
                "description": "Member's name."
              },
              "email": {
                "type": "string",
                "description": "Member's email address."
              },
              "roles": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TenantMemberRole"
                },
                "description": "Roles granted in the workspace."
              },
              "teams": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TenantMemberTeam"
                },
                "description": "Teams the member belongs to."
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "description": "When it last changed (ISO 8601)."
              },
              "invitationId": {
                "type": "string",
                "format": "uuid",
                "description": "Invitation ID; `null` for members who joined."
              },
              "membershipId": {
                "type": "null",
                "description": "Membership ID; `null` for pending invitations."
              },
              "recordId": {
                "type": "string",
                "format": "uuid",
                "description": "ID of this row (the invitation or the membership)."
              },
              "recordKind": {
                "type": "string",
                "const": "INVITATION",
                "description": "`INVITATION` (not accepted yet) or `MEMBERSHIP`."
              },
              "status": {
                "type": "string",
                "const": "INVITED",
                "description": "`INVITED`, `ACTIVE` or `SUSPENDED`."
              },
              "userId": {
                "type": "null",
                "description": "Member's user ID; `null` for pending invitations."
              }
            },
            "required": [
              "createdAt",
              "displayName",
              "email",
              "roles",
              "teams",
              "updatedAt",
              "invitationId",
              "membershipId",
              "recordId",
              "recordKind",
              "status",
              "userId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "description": "When the invitation or membership was created (ISO 8601)."
              },
              "displayName": {
                "type": "string",
                "description": "Member's name."
              },
              "email": {
                "type": "string",
                "description": "Member's email address."
              },
              "roles": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TenantMemberRole"
                },
                "description": "Roles granted in the workspace."
              },
              "teams": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TenantMemberTeam"
                },
                "description": "Teams the member belongs to."
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "description": "When it last changed (ISO 8601)."
              },
              "invitationId": {
                "type": "null",
                "description": "ID of the invitation; `null` if none."
              },
              "membershipId": {
                "type": "string",
                "format": "uuid",
                "description": "ID of the membership."
              },
              "recordId": {
                "type": "string",
                "format": "uuid",
                "description": "ID of the record."
              },
              "recordKind": {
                "type": "string",
                "const": "MEMBERSHIP",
                "description": "`INVITATION` (not accepted yet) or `MEMBERSHIP`."
              },
              "status": {
                "type": "string",
                "enum": [
                  "ACTIVE",
                  "SUSPENDED"
                ],
                "description": "Current status of the member."
              },
              "userId": {
                "type": "string",
                "format": "uuid",
                "description": "ID of the user."
              }
            },
            "required": [
              "createdAt",
              "displayName",
              "email",
              "roles",
              "teams",
              "updatedAt",
              "invitationId",
              "membershipId",
              "recordId",
              "recordKind",
              "status",
              "userId"
            ],
            "additionalProperties": false
          }
        ]
      },
      "TenantMemberPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TenantMember"
            },
            "description": "The records in this response, in the documented order."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; `null` on the last page."
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "TenantMemberRole": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the role."
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Stable machine key. Unlike the label, it never changes."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160,
            "description": "Name of the role, as shown in the LMS."
          }
        },
        "required": [
          "id",
          "key",
          "name"
        ],
        "additionalProperties": false
      },
      "TenantMemberTeam": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the member team."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the member team, as shown in the LMS."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ],
            "description": "Current status of the member team."
          }
        },
        "required": [
          "id",
          "name",
          "status"
        ],
        "additionalProperties": false
      },
      "TenantVoicebotUsageSummary": {
        "type": "object",
        "properties": {
          "answeredCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of answered records."
          },
          "attemptCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of attempt records."
          },
          "billableSeconds": {
            "type": "integer",
            "minimum": 0,
            "description": "Billable, in seconds."
          },
          "callerNumbers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "answeredCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of answered records."
                },
                "attemptCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Number of attempt records."
                },
                "display": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120,
                  "description": "The number as shown in the LMS."
                },
                "telephonyNumberId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the telephony number."
                }
              },
              "required": [
                "answeredCount",
                "attemptCount",
                "display",
                "telephonyNumberId"
              ],
              "additionalProperties": false
            },
            "description": "Usage per caller number."
          },
          "completedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of completed records."
          },
          "connectedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of connected records."
          },
          "failedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of failed records."
          },
          "outcomeCounts": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            },
            "description": "Number of calls per outcome."
          },
          "quota": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "consumed": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Calls used in this period."
                  },
                  "remaining": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Calls left in this period."
                  }
                },
                "required": [
                  "consumed",
                  "remaining"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Plan allowance for the period; `null` when unlimited."
          },
          "retryCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of retry records."
          },
          "ringSeconds": {
            "type": "integer",
            "minimum": 0,
            "description": "Ring, in seconds."
          },
          "streamSeconds": {
            "type": "integer",
            "minimum": 0,
            "description": "Stream, in seconds."
          },
          "talkSeconds": {
            "type": "integer",
            "minimum": 0,
            "description": "Talk, in seconds."
          },
          "uncertainCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of uncertain records."
          },
          "uniqueLeadCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of unique lead records."
          },
          "windowEnd": {
            "type": "string",
            "format": "date",
            "description": "End of the usage period (ISO 8601)."
          },
          "windowStart": {
            "type": "string",
            "format": "date",
            "description": "Start of the usage period (ISO 8601)."
          }
        },
        "required": [
          "answeredCount",
          "attemptCount",
          "billableSeconds",
          "callerNumbers",
          "completedCount",
          "connectedCount",
          "failedCount",
          "outcomeCounts",
          "quota",
          "retryCount",
          "ringSeconds",
          "streamSeconds",
          "talkSeconds",
          "uncertainCount",
          "uniqueLeadCount",
          "windowEnd",
          "windowStart"
        ],
        "additionalProperties": false
      },
      "TransitionLeadRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 100,
            "pattern": "^[A-Z][A-Z0-9_:-]*$",
            "description": "Your reason code, in upper case (for example `CRM_SYNC`). Kept in the lead's history."
          },
          "stageId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the stage."
          }
        },
        "required": [
          "reason",
          "stageId"
        ],
        "additionalProperties": false
      },
      "UpdateAllocationRulesetRequest": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "fallbackTeamId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the fallback team; `null` if none."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the allocation ruleset, as shown in the LMS."
          },
          "rules": {
            "$ref": "#/components/schemas/LeadAllocationRulesV1",
            "description": "Rules, checked in `priority` order; the first match wins."
          }
        },
        "required": [
          "expectedRevision",
          "fallbackTeamId",
          "name",
          "rules"
        ],
        "additionalProperties": false
      },
      "UpdateCampaignRequest": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "maxLength": 1000,
            "description": "Free-text description."
          },
          "endsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it ends (ISO 8601); `null` if not yet."
          },
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 120,
            "description": "Name of the campaign, as shown in the LMS."
          },
          "startsAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it starts (ISO 8601); `null` if not yet."
          },
          "status": {
            "$ref": "#/components/schemas/CampaignStatus",
            "description": "Current status of the campaign."
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "IANA time zone, for example `Asia/Kolkata`."
          }
        },
        "additionalProperties": false
      },
      "UpdateHumanFollowUp": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "DONE",
              "CANCELLED"
            ],
            "description": "Current status of the human follow up."
          },
          "dueAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it is due (ISO 8601)."
          }
        },
        "required": [
          "expectedRevision",
          "status"
        ],
        "additionalProperties": false
      },
      "UpdateLeadProfileRequest": {
        "type": "object",
        "properties": {
          "city": {
            "description": "New city; `null` clears it, leaving it out keeps it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "companyName": {
            "description": "New company name; `null` clears it, leaving it out keeps it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "country": {
            "description": "New country; `null` clears it, leaving it out keeps it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "expectedUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The lead's `updatedAt` from your last read. If it changed since, the request fails with `409` and nothing is saved."
          },
          "fullName": {
            "description": "New full name; `null` clears it, leaving it out keeps it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              {
                "type": "null"
              }
            ]
          },
          "inquirySummary": {
            "description": "New enquiry summary; `null` clears it, leaving it out keeps it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "priority": {
            "description": "New priority: `LOW`, `MEDIUM`, `HIGH` or `URGENT` (reported back as rank `1`–`4`).",
            "$ref": "#/components/schemas/LeadPriority"
          },
          "productInterest": {
            "description": "New product interest; `null` clears it, leaving it out keeps it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "description": "New state or region; `null` clears it, leaving it out keeps it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "expectedUpdatedAt"
        ],
        "additionalProperties": false
      },
      "UpdateMappingDraftRequest": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the mapping draft, as shown in the LMS."
          },
          "rules": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceFieldMappingRule"
            },
            "description": "Rules, checked in `priority` order; the first match wins."
          }
        },
        "required": [
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "UpdateProcessRequest": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "maxLength": 1000,
            "description": "Free-text description."
          },
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 120,
            "description": "Name of the process, as shown in the LMS."
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "IANA time zone, for example `Asia/Kolkata`."
          }
        },
        "additionalProperties": false
      },
      "UpdateRoutingRulesetRequest": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the routing ruleset, as shown in the LMS."
          },
          "rules": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceRoutingRule"
            },
            "description": "Rules, checked in `priority` order; the first match wins."
          }
        },
        "required": [
          "expectedRevision"
        ],
        "additionalProperties": false
      },
      "UpdateSegmentationRulesetRequest": {
        "type": "object",
        "properties": {
          "defaultSegmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the default segment; `null` if none."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the segmentation ruleset, as shown in the LMS."
          },
          "rules": {
            "$ref": "#/components/schemas/LeadSegmentationRulesV1",
            "description": "Rules, checked in `priority` order; the first match wins."
          }
        },
        "required": [
          "defaultSegmentId",
          "expectedRevision",
          "name",
          "rules"
        ],
        "additionalProperties": false
      },
      "UpdateSegmentationRulesetV2Request": {
        "type": "object",
        "properties": {
          "contractVersion": {
            "type": "number",
            "const": 2,
            "description": "Rule format version."
          },
          "defaultSegmentId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the default segment; `null` if none."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the segmentation ruleset, as shown in the LMS."
          },
          "rules": {
            "$ref": "#/components/schemas/LeadSegmentationRulesV2",
            "description": "Rules, checked in `priority` order; the first match wins."
          }
        },
        "required": [
          "contractVersion",
          "defaultSegmentId",
          "expectedRevision",
          "name",
          "rules"
        ],
        "additionalProperties": false
      },
      "UpdateSegmentationRulesetWireRequest": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/UpdateSegmentationRulesetV2Request"
          },
          {
            "$ref": "#/components/schemas/UpdateSegmentationRulesetRequest"
          }
        ]
      },
      "UpdateSegmentRequest": {
        "type": "object",
        "properties": {
          "colorToken": {
            "$ref": "#/components/schemas/SegmentColorToken",
            "description": "Colour used to show it in the LMS."
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text description."
          },
          "displayOrder": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Position in lists; lower numbers come first."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the segment, as shown in the LMS."
          }
        },
        "additionalProperties": false
      },
      "UpdateSourceConnectionRequest": {
        "type": "object",
        "properties": {
          "configuration": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            },
            "description": "Settings specific to this kind of source."
          },
          "defaultCampaignId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the default campaign; `null` if none."
          },
          "externalAccountId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the external account; `null` if none."
          },
          "externalAccountName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "Name of the external account, as shown in the LMS."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the source connection, as shown in the LMS."
          },
          "secretReference": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "description": "Reference to a stored secret; the secret itself is never returned."
          },
          "status": {
            "$ref": "#/components/schemas/LeadSourceStatus",
            "description": "Current status of the source connection."
          }
        },
        "additionalProperties": false
      },
      "UpdateStageRequest": {
        "type": "object",
        "properties": {
          "displayOrder": {
            "type": "integer",
            "minimum": 0,
            "description": "Position in lists; lower numbers come first."
          },
          "isActive": {
            "type": "boolean",
            "description": "Whether it is active."
          },
          "isInitial": {
            "type": "boolean",
            "description": "Whether it is initial."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the stage, as shown in the LMS."
          },
          "replaceInitial": {
            "type": "boolean",
            "const": true,
            "description": "Send `true` to make this the initial stage in place of the current one; otherwise a second initial stage is refused."
          },
          "semanticCategory": {
            "$ref": "#/components/schemas/SemanticStageCategory"
          }
        },
        "additionalProperties": false
      },
      "UpdateTeamRequest": {
        "type": "object",
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-text description."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "Name of the team, as shown in the LMS."
          }
        },
        "additionalProperties": false
      },
      "UpsertManagedVoicebotCampaignDraftRequest": {
        "type": "object",
        "properties": {
          "callingProfileId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the calling profile."
          },
          "callerIdId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the caller ID."
          },
          "callingWindows": {
            "minItems": 1,
            "maxItems": 14,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VoicebotCallingWindow"
            },
            "description": "When the voicebot may call: one entry per window."
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The `revision` from your last read. If the record changed since, the request fails with `409` and nothing is saved."
          },
          "language": {
            "type": "string",
            "minLength": 2,
            "maxLength": 35,
            "description": "Language, as an IETF tag such as `en-IN` or `hi-IN`."
          },
          "maxAttempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "Most call attempts per lead."
          },
          "outcomeMappings": {
            "type": "object",
            "additionalProperties": false,
            "description": "Which lead stage or disposition each voicebot outcome maps to.",
            "properties": {
              "CONNECTED_INTERESTED": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `CONNECTED_INTERESTED`; `null` changes nothing."
              },
              "CONNECTED_NOT_INTERESTED": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `CONNECTED_NOT_INTERESTED`; `null` changes nothing."
              },
              "CALLBACK_REQUESTED": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `CALLBACK_REQUESTED`; `null` changes nothing."
              },
              "NO_ANSWER": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `NO_ANSWER`; `null` changes nothing."
              },
              "BUSY": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `BUSY`; `null` changes nothing."
              },
              "INVALID_NUMBER": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `INVALID_NUMBER`; `null` changes nothing."
              },
              "DO_NOT_CALL": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `DO_NOT_CALL`; `null` changes nothing."
              },
              "BOT_FAILED": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Stage or disposition ID applied when the outcome is `BOT_FAILED`; `null` changes nothing."
              }
            }
          },
          "recordingConsentPolicyVersionId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "description": "ID of the recording consent policy version; `null` if none."
          },
          "recordingEnabled": {
            "default": false,
            "description": "Record voicebot calls.",
            "type": "boolean"
          },
          "retryBotFailureAfterAnswer": {
            "default": false,
            "description": "Retry a call when the bot failed after the customer answered.",
            "type": "boolean"
          },
          "retryDelaysMinutes": {
            "maxItems": 4,
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10080
            },
            "description": "Retry delays, in minutes."
          },
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "IANA time zone, for example `Asia/Kolkata`."
          },
          "voicebotProfileVersionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the voicebot profile version."
          }
        },
        "required": [
          "callingProfileId",
          "callerIdId",
          "callingWindows",
          "language",
          "maxAttempts",
          "outcomeMappings",
          "retryDelaysMinutes",
          "timezone",
          "voicebotProfileVersionId"
        ],
        "additionalProperties": false
      },
      "VoicebotCallingWindow": {
        "type": "object",
        "properties": {
          "days": {
            "minItems": 1,
            "maxItems": 7,
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 6
            },
            "description": "Days of the week the window applies to; `0` is Sunday."
          },
          "endsAt": {
            "type": "string",
            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
            "description": "When it ends (ISO 8601)."
          },
          "startsAt": {
            "type": "string",
            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
            "description": "When it starts (ISO 8601)."
          }
        },
        "required": [
          "days",
          "endsAt",
          "startsAt"
        ],
        "additionalProperties": false
      },
      "VoicebotOutcome": {
        "type": "string",
        "enum": [
          "CONNECTED_INTERESTED",
          "CONNECTED_NOT_INTERESTED",
          "CALLBACK_REQUESTED",
          "NO_ANSWER",
          "BUSY",
          "INVALID_NUMBER",
          "DO_NOT_CALL",
          "BOT_FAILED"
        ]
      },
      "VoidLeadActivityRequest": {
        "type": "object",
        "properties": {
          "expectedRevision": {
            "type": "integer",
            "minimum": 0,
            "description": "The activity's `revision` from your last read; `409` if it changed since."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Why you are voiding it; kept in the audit trail."
          }
        },
        "required": [
          "expectedRevision",
          "reason"
        ],
        "additionalProperties": false
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request is invalid.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "VALIDATION_ERROR",
                "message": "The JSON request body is invalid.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "The credential is missing, malformed, revoked or expired.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "INVALID_PARTNER_CREDENTIAL",
                "message": "A valid integration credential is required.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "The credential is valid but lacks the scope, or the acting member lacks the permission or data access.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "PARTNER_OPERATION_FORBIDDEN",
                "message": "This credential is not allowed to use this operation.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "The resource does not exist or is not visible to this credential.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "LEAD_NOT_FOUND",
                "message": "Lead not found.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "Conflict": {
        "description": "The request conflicts with the current state: a stale `expectedUpdatedAt` or revision, a workflow rule, or an `Idempotency-Key` reused with a different body.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "IDEMPOTENCY_CONFLICT",
                "message": "This key was used with a different request.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "Gone": {
        "description": "The cursor is older than the retention window.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "CURSOR_EXPIRED",
                "message": "The cursor is older than the 30-day retention window. Start again without a cursor.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "The request body is too large.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "REQUEST_BODY_TOO_LARGE",
                "message": "The request body is too large.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "UnsupportedMediaType": {
        "description": "`QUERY` requests need `Content-Type: application/json`.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "QUERY_CONTENT_TYPE_UNSUPPORTED",
                "message": "QUERY requests require Content-Type: application/json.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "UnprocessableContent": {
        "description": "The `QUERY` body is valid JSON but does not match the schema.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "QUERY_VALIDATION_FAILED",
                "message": "The QUERY request body is invalid.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "The API key's per-minute request budget is spent. Retry after `Retry-After` seconds.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "RATE_LIMITED",
                "message": "This API key allows 600 requests per minute. Retry after 12 seconds.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "InternalError": {
        "description": "Something went wrong on our side. Retry with backoff; quote `requestId` to support.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "UNEXPECTED_ERROR",
                "message": "The request could not be completed.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "BadGateway": {
        "description": "A downstream service (for example telephony) returned an error.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "TELEPHONY_UNAVAILABLE",
                "message": "Telephony returned an error. Try again shortly.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "A downstream service is temporarily unavailable. Retry with backoff.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorEnvelope"
            },
            "example": {
              "error": {
                "code": "SERVICE_UNAVAILABLE",
                "message": "The service is temporarily unavailable. Try again shortly.",
                "requestId": "7d0c2f4e-3b1a-4f5e-9c8d-2a1b0c9d8e7f"
              }
            }
          }
        }
      }
    },
    "parameters": {
      "TenantSlug": {
        "name": "tenantSlug",
        "in": "path",
        "required": true,
        "description": "Your workspace slug: the first part of your LMS web address (`/your-workspace/…`).",
        "schema": {
          "type": "string",
          "minLength": 3,
          "maxLength": 63,
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "example": "your-workspace"
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Makes the request safe to retry: the same key with the same body returns the original result; with a different body, `409`.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9._:-]{8,128}$",
          "description": "8–128 letters, digits, dots, underscores, colons or hyphens. Reuse the same key to retry the same request safely.",
          "examples": [
            "crm-123-2026-12-01"
          ]
        }
      },
      "WebhookId": {
        "name": "webhook-id",
        "in": "header",
        "required": true,
        "description": "Event ID; identical across retries and replays. De-duplicate on it.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "WebhookTimestamp": {
        "name": "webhook-timestamp",
        "in": "header",
        "required": true,
        "description": "Unix time in seconds when this attempt was signed. Reject messages more than 5 minutes old.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]+$"
        }
      },
      "WebhookSignature": {
        "name": "webhook-signature",
        "in": "header",
        "required": true,
        "description": "Space-separated signatures, each `v1,<base64 HMAC-SHA256 of \"{webhook-id}.{webhook-timestamp}.{body}\">`. During secret rotation two signatures are sent; accept the message if any matches.",
        "schema": {
          "type": "string"
        }
      }
    },
    "headers": {
      "RateLimit-Limit": {
        "description": "Requests allowed per minute for this API key.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Remaining": {
        "description": "Requests left in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the window resets.",
        "schema": {
          "type": "integer"
        }
      },
      "X-Request-Id": {
        "description": "Unique ID of this request. Quote it when you contact support.",
        "schema": {
          "type": "string"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "lms_<keyId>.<secret>",
        "description": "Tenant API key from Settings → Integrations → API keys. The token is shown once when the key is created or rotated."
      },
      "partnerToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "<integrationId>.<token>",
        "description": "Legacy environment credential configured on the server (`LMS_PARTNER_CONNECTIONS`). Prefer API keys for new integrations."
      }
    }
  }
}
